From 5d268cf7c6484dd9aaad2dd2fba26811a68e4c06 Mon Sep 17 00:00:00 2001 From: Isac Petinate Date: Thu, 9 May 2024 21:10:12 -0300 Subject: [PATCH] fix: vue components imports inside templates --- src/generators/storybook-story.js | 1 + src/templates/storybook/vue/3/js/Component.js | 2 +- src/templates/storybook/vue/3/ts/Component.ts | 2 +- src/templates/unit-test/vue/js/JestTestingLibrary.js | 2 +- src/templates/unit-test/vue/js/JestVanilla.js | 2 +- src/templates/unit-test/vue/js/VitestTestingLibrary.js | 2 +- src/templates/unit-test/vue/js/VitestVanilla.js | 2 +- src/templates/unit-test/vue/ts/Jest.ts | 2 +- src/templates/unit-test/vue/ts/JestTestingLibrary.ts | 2 +- src/templates/unit-test/vue/ts/Vitest.ts | 2 +- src/templates/unit-test/vue/ts/VitestTestingLibrary.ts | 2 +- 11 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/generators/storybook-story.js b/src/generators/storybook-story.js index 23a7cc7..cc66464 100644 --- a/src/generators/storybook-story.js +++ b/src/generators/storybook-story.js @@ -164,6 +164,7 @@ export function replaceAllTestTextOccurrences(data) { data.fileContent = data.fileContent.replace(/resourcePath/g, resourcePath) } + if (data.framework === FrameworkEnum.react) { const resourcePath = removePostfixAndExt(data.resourcePathWithFileName) diff --git a/src/templates/storybook/vue/3/js/Component.js b/src/templates/storybook/vue/3/js/Component.js index fb8eba5..36c4d2b 100644 --- a/src/templates/storybook/vue/3/js/Component.js +++ b/src/templates/storybook/vue/3/js/Component.js @@ -2,7 +2,7 @@ import { ArgTypes, Meta, StoryFn } from '@storybook/vue3' import { toRefs } from 'vue' -import ResourceName from 'resourcePath' +import ResourceName from 'resourcePath.vue' const argTypes = { // Describe your args type (component properties) here to autodocs show properly informations diff --git a/src/templates/storybook/vue/3/ts/Component.ts b/src/templates/storybook/vue/3/ts/Component.ts index 75b4809..a15c170 100644 --- a/src/templates/storybook/vue/3/ts/Component.ts +++ b/src/templates/storybook/vue/3/ts/Component.ts @@ -2,7 +2,7 @@ import type { ArgTypes, Args, Meta, StoryFn } from '@storybook/vue3' import { toRefs } from 'vue' -import ResourceName from 'resourcePath' +import ResourceName from 'resourcePath.vue' type Props = InstanceType diff --git a/src/templates/unit-test/vue/js/JestTestingLibrary.js b/src/templates/unit-test/vue/js/JestTestingLibrary.js index a4f6f23..0d9af6d 100644 --- a/src/templates/unit-test/vue/js/JestTestingLibrary.js +++ b/src/templates/unit-test/vue/js/JestTestingLibrary.js @@ -1,6 +1,6 @@ import { render, screen } from '@testing-library/vue' -import ResourceName from 'resourcePath' +import ResourceName from 'resourcePath.vue' describe('ResourceName', () => { const componentData = { diff --git a/src/templates/unit-test/vue/js/JestVanilla.js b/src/templates/unit-test/vue/js/JestVanilla.js index 54f8611..2889836 100644 --- a/src/templates/unit-test/vue/js/JestVanilla.js +++ b/src/templates/unit-test/vue/js/JestVanilla.js @@ -1,6 +1,6 @@ import { shallowMount } from '@vue/test-utils' -import ResourceName from 'resourcePath' +import ResourceName from 'resourcePath.vue' describe('ResourceName', () => { const wrapper = shallowMount(ResourceName) diff --git a/src/templates/unit-test/vue/js/VitestTestingLibrary.js b/src/templates/unit-test/vue/js/VitestTestingLibrary.js index 1fc1988..519fc03 100644 --- a/src/templates/unit-test/vue/js/VitestTestingLibrary.js +++ b/src/templates/unit-test/vue/js/VitestTestingLibrary.js @@ -2,7 +2,7 @@ import { render, screen } from '@testing-library/vue' import { describe, it, expect } from 'vitest' -import ResourceName from 'resourcePath' +import ResourceName from 'resourcePath.vue' describe('ResourceName', () => { const componentData = { diff --git a/src/templates/unit-test/vue/js/VitestVanilla.js b/src/templates/unit-test/vue/js/VitestVanilla.js index 50b2f04..3b4153c 100644 --- a/src/templates/unit-test/vue/js/VitestVanilla.js +++ b/src/templates/unit-test/vue/js/VitestVanilla.js @@ -2,7 +2,7 @@ import { shallowMount } from '@vue/test-utils' import { describe, it, expect } from 'vitest' -import ResourceName from 'resourcePath' +import ResourceName from 'resourcePath.vue' describe('ResourceName', () => { const wrapper = shallowMount(ResourceName) diff --git a/src/templates/unit-test/vue/ts/Jest.ts b/src/templates/unit-test/vue/ts/Jest.ts index 54f8611..2889836 100644 --- a/src/templates/unit-test/vue/ts/Jest.ts +++ b/src/templates/unit-test/vue/ts/Jest.ts @@ -1,6 +1,6 @@ import { shallowMount } from '@vue/test-utils' -import ResourceName from 'resourcePath' +import ResourceName from 'resourcePath.vue' describe('ResourceName', () => { const wrapper = shallowMount(ResourceName) diff --git a/src/templates/unit-test/vue/ts/JestTestingLibrary.ts b/src/templates/unit-test/vue/ts/JestTestingLibrary.ts index 73b2884..8dd4b59 100644 --- a/src/templates/unit-test/vue/ts/JestTestingLibrary.ts +++ b/src/templates/unit-test/vue/ts/JestTestingLibrary.ts @@ -1,6 +1,6 @@ import { render, screen, type RenderOptions } from '@testing-library/vue' -import ResourceName from 'resourcePath' +import ResourceName from 'resourcePath.vue' type RenderComponent = { props: InstanceType['$props'] diff --git a/src/templates/unit-test/vue/ts/Vitest.ts b/src/templates/unit-test/vue/ts/Vitest.ts index 50b2f04..3b4153c 100644 --- a/src/templates/unit-test/vue/ts/Vitest.ts +++ b/src/templates/unit-test/vue/ts/Vitest.ts @@ -2,7 +2,7 @@ import { shallowMount } from '@vue/test-utils' import { describe, it, expect } from 'vitest' -import ResourceName from 'resourcePath' +import ResourceName from 'resourcePath.vue' describe('ResourceName', () => { const wrapper = shallowMount(ResourceName) diff --git a/src/templates/unit-test/vue/ts/VitestTestingLibrary.ts b/src/templates/unit-test/vue/ts/VitestTestingLibrary.ts index 12bd09a..3417aff 100644 --- a/src/templates/unit-test/vue/ts/VitestTestingLibrary.ts +++ b/src/templates/unit-test/vue/ts/VitestTestingLibrary.ts @@ -2,7 +2,7 @@ import { render, screen, type RenderOptions } from '@testing-library/vue' import { describe, it, expect } from 'vitest' -import ResourceName from 'resourcePath' +import ResourceName from 'resourcePath.vue' type RenderComponent = { props: InstanceType['$props']