diff --git a/examples/app-vitest-full/package.json b/examples/app-vitest-full/package.json index 4ac63af0e..5e7912fd6 100644 --- a/examples/app-vitest-full/package.json +++ b/examples/app-vitest-full/package.json @@ -23,7 +23,7 @@ "listhen": "^1.5.5", "nuxt": "3.8.2", "typescript": "5.2.2", - "vitest": "1.0.0-beta.6", + "vitest": "0.34.6", "vue-tsc": "1.8.19" }, "version": "0.10.2", diff --git a/examples/app-vitest-full/tests/nuxt/index.spec.ts b/examples/app-vitest-full/tests/nuxt/index.spec.ts index 46acb463c..0ae1b6918 100644 --- a/examples/app-vitest-full/tests/nuxt/index.spec.ts +++ b/examples/app-vitest-full/tests/nuxt/index.spec.ts @@ -65,7 +65,7 @@ describe('test utils', () => { "
This is an auto-imported component
I am a global component
Index page
- Test link " + Test link " `) }) diff --git a/examples/app-vitest-full/tests/nuxt/mock-component-1.spec.ts b/examples/app-vitest-full/tests/nuxt/mock-component-1.spec.ts index 6e69d5f94..99e31fd19 100644 --- a/examples/app-vitest-full/tests/nuxt/mock-component-1.spec.ts +++ b/examples/app-vitest-full/tests/nuxt/mock-component-1.spec.ts @@ -17,6 +17,6 @@ it('should mock', async () => { "
Mocked
I am a global component
Index page
- Test link " + Test link " `) }) diff --git a/examples/app-vitest-full/tests/nuxt/mock-component-2.spec.ts b/examples/app-vitest-full/tests/nuxt/mock-component-2.spec.ts index 6fec459b6..85b187a11 100644 --- a/examples/app-vitest-full/tests/nuxt/mock-component-2.spec.ts +++ b/examples/app-vitest-full/tests/nuxt/mock-component-2.spec.ts @@ -10,6 +10,6 @@ it('should mock', async () => { "
Mocked 1 * 2 = 2
I am a global component
Index page
- Test link " + Test link " `) }) diff --git a/examples/app-vitest-full/tests/nuxt/utils-render.spec.ts b/examples/app-vitest-full/tests/nuxt/utils-render.spec.ts index a056c358f..4141f1ddc 100644 --- a/examples/app-vitest-full/tests/nuxt/utils-render.spec.ts +++ b/examples/app-vitest-full/tests/nuxt/utils-render.spec.ts @@ -21,10 +21,10 @@ describe('test utils', () => { it('can render components within nuxt suspense', async () => { const { html } = await renderSuspended(App) expect(html()).toMatchInlineSnapshot(` - "
+ "
This is an auto-imported component
I am a global component
-
Index page
Test link +
Index page
Test link
" `) }) diff --git a/examples/module/package.json b/examples/module/package.json index 26cbf4d6a..6675d80a0 100644 --- a/examples/module/package.json +++ b/examples/module/package.json @@ -37,6 +37,6 @@ "@nuxt/test-utils": "latest", "changelogen": "^0.5.5", "nuxt": "^3.8.2", - "vitest": "1.0.0-beta.6" + "vitest": "0.34.6" } } diff --git a/package.json b/package.json index 6521b83ce..33151583d 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "unbuild": "latest", "unimport": "3.6.0", "vite": "5.0.4", - "vitest": "1.0.0-beta.6", + "vitest": "0.34.6", "vue-router": "4.2.5", "vue-tsc": "1.8.24" }, @@ -94,7 +94,7 @@ "jsdom": "^22.0.0 || ^23.0.0", "playwright-core": "^1.34.3", "vite": "*", - "vitest": "^0.24.5 || ^0.26.0 || ^0.27.0 || ^0.28.0 || ^0.29.0 || ^0.30.0 || ^0.33.0 || ^1.0.0-beta.6", + "vitest": "^0.24.5 || ^0.26.0 || ^0.27.0 || ^0.28.0 || ^0.29.0 || ^0.30.0 || ^0.33.0 || ^0.34.6", "vue": "^3.3.4", "vue-router": "^4.0.0" }, @@ -126,7 +126,6 @@ }, "resolutions": { "@nuxt/test-utils": "workspace:*", - "vite-node": "1.0.0-beta.6", "vitest-environment-nuxt": "workspace:*", "rollup": "4.6.1", "vite": "5.0.4" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 45e452911..61fb980b1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,7 +6,6 @@ settings: overrides: '@nuxt/test-utils': workspace:* - vite-node: 1.0.0-beta.6 vitest-environment-nuxt: workspace:* rollup: 4.6.1 vite: 5.0.4 @@ -108,7 +107,7 @@ importers: version: 21.1.6 '@vitest/ui': specifier: 0.33.0 - version: 0.33.0(vitest@1.0.0-beta.6) + version: 0.33.0(vitest@0.34.6) '@vue/test-utils': specifier: 2.4.3 version: 2.4.3(vue@3.3.9) @@ -152,8 +151,8 @@ importers: specifier: 5.0.4 version: 5.0.4(@types/node@20.10.0) vitest: - specifier: 1.0.0-beta.6 - version: 1.0.0-beta.6(@vitest/ui@0.33.0)(happy-dom@12.10.3)(jsdom@22.1.0) + specifier: 0.34.6 + version: 0.34.6(@vitest/ui@0.33.0)(happy-dom@12.10.3)(jsdom@22.1.0) vue-router: specifier: 4.2.5 version: 4.2.5(vue@3.3.9) @@ -248,8 +247,8 @@ importers: specifier: 5.2.2 version: 5.2.2 vitest: - specifier: 1.0.0-beta.6 - version: 1.0.0-beta.6(@vitest/ui@0.33.0)(happy-dom@12.10.3)(jsdom@22.1.0) + specifier: 0.34.6 + version: 0.34.6(@vitest/ui@0.33.0)(happy-dom@12.10.3)(jsdom@22.1.0) vue-tsc: specifier: 1.8.19 version: 1.8.19(typescript@5.2.2) @@ -282,8 +281,8 @@ importers: specifier: ^3.8.2 version: 3.8.2(eslint@8.55.0)(rollup@4.6.1)(typescript@5.2.2)(vite@5.0.4)(vue-tsc@1.8.24) vitest: - specifier: 1.0.0-beta.6 - version: 1.0.0-beta.6(@vitest/ui@0.33.0)(happy-dom@12.10.3)(jsdom@22.1.0) + specifier: 0.34.6 + version: 0.34.6(@vitest/ui@0.33.0)(happy-dom@12.10.3)(jsdom@22.1.0) examples/module/playground: dependencies: @@ -1999,7 +1998,7 @@ packages: ufo: 1.3.2 unplugin: 1.5.1 vite: 5.0.4(@types/node@20.10.0) - vite-node: 1.0.0-beta.6(@types/node@20.10.0) + vite-node: 0.33.0(@types/node@20.10.0) vite-plugin-checker: 0.6.2(eslint@8.55.0)(typescript@5.2.2)(vite@5.0.4)(vue-tsc@1.8.24) vue: 3.3.9(typescript@5.2.2) vue-bundle-renderer: 2.0.0 @@ -2059,7 +2058,7 @@ packages: ufo: 1.3.2 unplugin: 1.5.1 vite: 5.0.4(@types/node@20.10.0) - vite-node: 1.0.0-beta.6(@types/node@20.10.0) + vite-node: 0.33.0(@types/node@20.10.0) vite-plugin-checker: 0.6.2(eslint@8.55.0)(typescript@5.2.2)(vite@5.0.4)(vue-tsc@1.8.19) vue: 3.3.9(typescript@5.2.2) vue-bundle-renderer: 2.0.0 @@ -2119,7 +2118,7 @@ packages: ufo: 1.3.2 unplugin: 1.5.1 vite: 5.0.4(@types/node@20.10.0) - vite-node: 1.0.0-beta.6(@types/node@20.10.0) + vite-node: 0.33.0(@types/node@20.10.0) vite-plugin-checker: 0.6.2(eslint@8.55.0)(typescript@5.2.2)(vite@5.0.4)(vue-tsc@1.8.24) vue: 3.3.9(typescript@5.2.2) vue-bundle-renderer: 2.0.0 @@ -2650,6 +2649,16 @@ packages: '@babel/types': 7.23.4 dev: true + /@types/chai-subset@1.3.5: + resolution: {integrity: sha512-c2mPnw+xHtXDoHmdtcCXGwyLMiauiAyxWMzhGpqHC4nqI/Y5G2XhTampslK2rb59kpcuHon03UH8W6iYUzw88A==} + dependencies: + '@types/chai': 4.3.11 + dev: true + + /@types/chai@4.3.11: + resolution: {integrity: sha512-qQR1dr2rGIHYlJulmr8Ioq3De0Le9E4MJ5AiaeAETJJpndT1uUNHsGFK3L/UIu+rbkQSdj8J/w2bCsBZc/Y5fQ==} + dev: true + /@types/estree@1.0.5: resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} @@ -2950,37 +2959,37 @@ packages: vite: 5.0.4(@types/node@20.10.0) vue: 3.3.9(typescript@5.2.2) - /@vitest/expect@1.0.0-beta.6: - resolution: {integrity: sha512-leCesYErICeBQEz0Tzaopad1cnCUBfR1gDk2nFxHCChv7gdYTezcC2YRlPCwA8TuWGCXs8cdyTFO5R6QhUfY9A==} + /@vitest/expect@0.34.6: + resolution: {integrity: sha512-QUzKpUQRc1qC7qdGo7rMK3AkETI7w18gTCUrsNnyjjJKYiuUB9+TQK3QnR1unhCnWRC0AbKv2omLGQDF/mIjOw==} dependencies: - '@vitest/spy': 1.0.0-beta.6 - '@vitest/utils': 1.0.0-beta.6 + '@vitest/spy': 0.34.6 + '@vitest/utils': 0.34.6 chai: 4.3.10 dev: true - /@vitest/runner@1.0.0-beta.6: - resolution: {integrity: sha512-pcFo7XRaALk44ck8LpcjtIsr2Ue4jFNfaq5MDlHupAekkJdDdFrAAfOmsE/LnIqeUsnd/6IaKvLX1oRnCkz6kg==} + /@vitest/runner@0.34.6: + resolution: {integrity: sha512-1CUQgtJSLF47NnhN+F9X2ycxUP0kLHQ/JWvNHbeBfwW8CzEGgeskzNnHDyv1ieKTltuR6sdIHV+nmR6kPxQqzQ==} dependencies: - '@vitest/utils': 1.0.0-beta.6 - p-limit: 5.0.0 + '@vitest/utils': 0.34.6 + p-limit: 4.0.0 pathe: 1.1.1 dev: true - /@vitest/snapshot@1.0.0-beta.6: - resolution: {integrity: sha512-znkf7R67aanWHjAfx+/Yj5VwIdUHU1I1akJFL8lguiu5C6C12D4ICHeMjRBc7e7BrIguBWZFfqPx/ZUSxqMTfA==} + /@vitest/snapshot@0.34.6: + resolution: {integrity: sha512-B3OZqYn6k4VaN011D+ve+AA4whM4QkcwcrwaKwAbyyvS/NB1hCWjFIBQxAQQSQir9/RtyAAGuq+4RJmbn2dH4w==} dependencies: magic-string: 0.30.5 pathe: 1.1.1 pretty-format: 29.7.0 dev: true - /@vitest/spy@1.0.0-beta.6: - resolution: {integrity: sha512-AaR9a/ecsJ4lMeC5ZdsTfXqBVxA7ZrmT3q/ooUGXYvAtSxETn39gWC6h7wxUCtKwTLClq+5FmA03Co5/zmGMBw==} + /@vitest/spy@0.34.6: + resolution: {integrity: sha512-xaCvneSaeBw/cz8ySmF7ZwGvL0lBjfvqc1LpQ/vcdHEvpLn3Ff1vAvjw+CoGn0802l++5L/pxb7whwcWAw+DUQ==} dependencies: tinyspy: 2.2.0 dev: true - /@vitest/ui@0.33.0(vitest@1.0.0-beta.6): + /@vitest/ui@0.33.0(vitest@0.34.6): resolution: {integrity: sha512-7gbAjLqt30R4bodkJAutdpy4ncv+u5IKTHYTow1c2q+FOxZUC9cKOSqMUxjwaaTwLN+EnDnmXYPtg3CoahaUzQ==} peerDependencies: vitest: '>=0.30.1 <1' @@ -2992,7 +3001,7 @@ packages: pathe: 1.1.1 picocolors: 1.0.0 sirv: 2.0.3 - vitest: 1.0.0-beta.6(@vitest/ui@0.33.0)(happy-dom@12.10.3)(jsdom@22.1.0) + vitest: 0.34.6(@vitest/ui@0.33.0)(happy-dom@12.10.3)(jsdom@22.1.0) dev: true /@vitest/utils@0.33.0: @@ -3003,8 +3012,8 @@ packages: pretty-format: 29.7.0 dev: true - /@vitest/utils@1.0.0-beta.6: - resolution: {integrity: sha512-PyUf4dTFRLfq6YAdAab39i32O/qhpeCVM7cUpN1au7BrvYI/e43ZDhhHdwbt8zP14l06PNrXd5nTSZPFQwmsVw==} + /@vitest/utils@0.34.6: + resolution: {integrity: sha512-IG5aDD8S6zlvloDsnzHw0Ut5xczlF+kv2BOTo+iXfPr54Yhi5qbVOgGB1hZaVq4iJ4C/MZ2J0y15IlsV/ZcI0A==} dependencies: diff-sequences: 29.6.3 loupe: 2.3.7 @@ -7613,9 +7622,9 @@ packages: dependencies: yocto-queue: 0.1.0 - /p-limit@5.0.0: - resolution: {integrity: sha512-/Eaoq+QyLSiXQ4lyYV23f14mZRQcXnxfHrN0vCai+ak9G0pp9iEQukIIZq5NccEvwRB8PUnZT0KsOoDCINS1qQ==} - engines: {node: '>=18'} + /p-limit@4.0.0: + resolution: {integrity: sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} dependencies: yocto-queue: 1.0.0 dev: true @@ -8918,8 +8927,8 @@ packages: resolution: {integrity: sha512-65NKvSuAVDP/n4CqH+a9w2kTlLReS9vhsAP06MWx+/89nMinJyB2icyl58RIcqCmIggpojIGeuJGhjU1aGMBSg==} dev: true - /tinypool@0.8.1: - resolution: {integrity: sha512-zBTCK0cCgRROxvs9c0CGK838sPkeokNGdQVUUwHAbynHFlmyJYj825f/oRs528HaIJ97lo0pLIlDUzwN+IorWg==} + /tinypool@0.7.0: + resolution: {integrity: sha512-zSYNUlYSMhJ6Zdou4cJwo/p7w5nmAH17GRfU/ui3ctvjXFErXXkruT4MWW6poDeXgCaIBlGLrfU6TbTXxyGMww==} engines: {node: '>=14.0.0'} dev: true @@ -9444,13 +9453,35 @@ packages: dependencies: builtins: 5.0.1 - /vite-node@1.0.0-beta.6(@types/node@20.10.0): - resolution: {integrity: sha512-cDRdVdirWxw8AODIGzdM0uI5J4Ts7evXzelFAQgngSyblaQG84PUsVHeMIhNWWM5L1K0hst+R2ecJzPUgI6tCw==} - engines: {node: ^18.0.0 || >=20.0.0} + /vite-node@0.33.0(@types/node@20.10.0): + resolution: {integrity: sha512-19FpHYbwWWxDr73ruNahC+vtEdza52kA90Qb3La98yZ0xULqV8A5JLNPUff0f5zID4984tW7l3DH2przTJUZSw==} + engines: {node: '>=v14.18.0'} + hasBin: true + dependencies: + cac: 6.7.14 + debug: 4.3.4 + mlly: 1.4.2 + pathe: 1.1.1 + picocolors: 1.0.0 + vite: 5.0.4(@types/node@20.10.0) + transitivePeerDependencies: + - '@types/node' + - less + - lightningcss + - sass + - stylus + - sugarss + - supports-color + - terser + + /vite-node@0.34.6(@types/node@20.10.0): + resolution: {integrity: sha512-nlBMJ9x6n7/Amaz6F3zJ97EBwR2FkzhBRxF5e+jE6LA3yi6Wtc2lyTij1OnDMIr34v5g/tVQtsVAzhT0jc5ygA==} + engines: {node: '>=v14.18.0'} hasBin: true dependencies: cac: 6.7.14 debug: 4.3.4 + mlly: 1.4.2 pathe: 1.1.1 picocolors: 1.0.0 vite: 5.0.4(@types/node@20.10.0) @@ -9463,6 +9494,7 @@ packages: - sugarss - supports-color - terser + dev: true /vite-plugin-checker@0.6.2(eslint@8.55.0)(typescript@5.2.2)(vite@5.0.4)(vue-tsc@1.8.19): resolution: {integrity: sha512-YvvvQ+IjY09BX7Ab+1pjxkELQsBd4rPhWNw8WLBeFVxu/E7O+n6VYAqNsKdK/a2luFlX/sMpoWdGFfg4HvwdJQ==} @@ -9648,22 +9680,22 @@ packages: optionalDependencies: fsevents: 2.3.3 - /vitest@1.0.0-beta.6(@vitest/ui@0.33.0)(happy-dom@12.10.3)(jsdom@22.1.0): - resolution: {integrity: sha512-yahr45sIcSq8SaY9FUcmWLrsDMAL3mCd/vC890uymiZhrZ5VQrqMmOT0FcB7vtC4kh327p6IXWqHHLr7B0hRug==} - engines: {node: ^18.0.0 || >=20.0.0} + /vitest@0.34.6(@vitest/ui@0.33.0)(happy-dom@12.10.3)(jsdom@22.1.0): + resolution: {integrity: sha512-+5CALsOvbNKnS+ZHMXtuUC7nL8/7F1F2DnHGjSsszX8zCjWSSviphCb/NuS9Nzf4Q03KyyDRBAXhF/8lffME4Q==} + engines: {node: '>=v14.18.0'} hasBin: true peerDependencies: '@edge-runtime/vm': '*' - '@types/node': ^18.0.0 || >=20.0.0 '@vitest/browser': '*' '@vitest/ui': '*' happy-dom: '*' jsdom: '*' + playwright: '*' + safaridriver: '*' + webdriverio: '*' peerDependenciesMeta: '@edge-runtime/vm': optional: true - '@types/node': - optional: true '@vitest/browser': optional: true '@vitest/ui': @@ -9672,30 +9704,39 @@ packages: optional: true jsdom: optional: true + playwright: + optional: true + safaridriver: + optional: true + webdriverio: + optional: true dependencies: - '@vitest/expect': 1.0.0-beta.6 - '@vitest/runner': 1.0.0-beta.6 - '@vitest/snapshot': 1.0.0-beta.6 - '@vitest/spy': 1.0.0-beta.6 - '@vitest/ui': 0.33.0(vitest@1.0.0-beta.6) - '@vitest/utils': 1.0.0-beta.6 + '@types/chai': 4.3.11 + '@types/chai-subset': 1.3.5 + '@types/node': 20.10.0 + '@vitest/expect': 0.34.6 + '@vitest/runner': 0.34.6 + '@vitest/snapshot': 0.34.6 + '@vitest/spy': 0.34.6 + '@vitest/ui': 0.33.0(vitest@0.34.6) + '@vitest/utils': 0.34.6 + acorn: 8.11.2 acorn-walk: 8.3.0 cac: 6.7.14 chai: 4.3.10 debug: 4.3.4 - execa: 8.0.1 happy-dom: 12.10.3 jsdom: 22.1.0 - local-pkg: 0.5.0 + local-pkg: 0.4.3 magic-string: 0.30.5 pathe: 1.1.1 picocolors: 1.0.0 std-env: 3.6.0 strip-literal: 1.3.0 tinybench: 2.5.1 - tinypool: 0.8.1 + tinypool: 0.7.0 vite: 5.0.4(@types/node@20.10.0) - vite-node: 1.0.0-beta.6(@types/node@20.10.0) + vite-node: 0.34.6(@types/node@20.10.0) why-is-node-running: 2.2.2 transitivePeerDependencies: - less diff --git a/src/config.ts b/src/config.ts index d6d336591..7c3e56261 100644 --- a/src/config.ts +++ b/src/config.ts @@ -92,24 +92,21 @@ export async function getVitestConfigFromNuxt( ['**/*.nuxt.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}', 'nuxt'], ['{test,tests}/nuxt/**.*', 'nuxt'], ], - server: { - deps: { - inline: [ - // vite-node defaults - /\/node_modules\/(.*\/)?(nuxt|nuxt3|nuxt-nightly)\//, - /^#/, - // additional deps - '@nuxt/test-utils', - '@nuxt/test-utils-nightly', - '@nuxt/test-utils-edge', - 'vitest-environment-nuxt', - ...(options.nuxt.options.build.transpile.filter( - r => typeof r === 'string' || r instanceof RegExp - ) as Array), - ], - } - }, deps: { + // TODO: move to server.deps.inline when we update to vite v1 + inline: [ + // vite-node defaults + /\/node_modules\/(.*\/)?(nuxt|nuxt3|nuxt-nightly)\//, + /^#/, + // additional deps + '@nuxt/test-utils', + '@nuxt/test-utils-nightly', + '@nuxt/test-utils-edge', + 'vitest-environment-nuxt', + ...(options.nuxt.options.build.transpile.filter( + r => typeof r === 'string' || r instanceof RegExp + ) as Array), + ], optimizer: { web: { enabled: false, diff --git a/src/module/plugins/mock.ts b/src/module/plugins/mock.ts index 650b818de..33e618f98 100644 --- a/src/module/plugins/mock.ts +++ b/src/module/plugins/mock.ts @@ -277,7 +277,7 @@ export const createMockPlugin = (ctx: MockPluginContext) => createUnplugin(() => const plugins = (config.plugins || []) as Plugin[] // `vite:mocks` was a typo in Vitest before v0.34.0 - const vitestPlugins = plugins.filter(p => p.name.startsWith('vitest:') && (p.enforce || (p as any).order) === 'post') + const vitestPlugins = plugins.filter(p => (p.name === 'vite:mocks' || p.name.startsWith('vitest:')) && (p.enforce || (p as any).order) === 'post') const lastNuxt = findLastIndex( plugins, i => i.name?.startsWith('nuxt:') diff --git a/test/unit/mock-transform.spec.ts b/test/unit/mock-transform.spec.ts index be1a2fdcc..d0df02643 100644 --- a/test/unit/mock-transform.spec.ts +++ b/test/unit/mock-transform.spec.ts @@ -48,27 +48,27 @@ describe('mocking', () => { return () => 'mocked' }) `)).toMatchInlineSnapshot(` - "import {vi} from "vitest"; + "import {vi} from \\"vitest\\"; vi.hoisted(() => { if(!globalThis.__NUXT_VITEST_MOCKS){ - vi.stubGlobal("__NUXT_VITEST_MOCKS", {}) + vi.stubGlobal(\\"__NUXT_VITEST_MOCKS\\", {}) } }); - vi.mock("bob", async (importOriginal) => { + vi.mock(\\"bob\\", async (importOriginal) => { const mocks = globalThis.__NUXT_VITEST_MOCKS - if (!mocks["bob"]) { - mocks["bob"] = { ...await importOriginal("bob") } + if (!mocks[\\"bob\\"]) { + mocks[\\"bob\\"] = { ...await importOriginal(\\"bob\\") } } - mocks["bob"]["useSomeExport"] = await (() => { + mocks[\\"bob\\"][\\"useSomeExport\\"] = await (() => { return () => 'mocked' })(); - return mocks["bob"] + return mocks[\\"bob\\"] }); import { mockNuxtImport } from '@nuxt/test-utils/runtime-utils' - import "bob";" + import \\"bob\\";" `) }) it('should not add `vi` import if it already exists', async () => { @@ -100,13 +100,13 @@ describe('mocking', () => { import { mockComponent } from '@nuxt/test-utils/runtime-utils' mockComponent('MyComponent', () => import('./MockComponent.vue')) `)).toMatchInlineSnapshot(` - "import {vi} from "vitest"; + "import {vi} from \\"vitest\\"; vi.hoisted(() => { if(!globalThis.__NUXT_VITEST_MOCKS){ - vi.stubGlobal("__NUXT_VITEST_MOCKS", {}) + vi.stubGlobal(\\"__NUXT_VITEST_MOCKS\\", {}) } }); - vi.mock("MyComponent", async () => { + vi.mock(\\"MyComponent\\", async () => { const factory = (() => import('./MockComponent.vue')); const result = typeof factory === 'function' ? await factory() : await factory return 'default' in result ? result : { default: result }