\n\n### Workaround\nUsing `defineVitestConfig` and hoisting the configuration up to root works fine. Unfortunately I'd need to run three Vitest tasks and couldn't make use of the `projects` functionality.\n\nFor example:\n\n```\npnpm vitest --config vitest.browser.config.ts\npnpm vitest --config vitest.unit.config.ts\npnpm vitest --config vitest.e2e.config.ts\n# 😔\n```\n\n---\n\nSo, I can't figure out how to get it working. I've tried different combinations, singular projects, and using the deprecated `workspaces` key. The method `defineVitestProject` isn't documented and I've read through the code and I'm not really sure why I'm getting an error.\n\n### Nuxt Info\n\n```\n- Operating System: `Darwin`\n- Node Version: `v22.14.0`\n- Nuxt Version: `3.17.5`\n- CLI Version: `3.25.1`\n- Nitro Version: `2.11.12`\n- Package Manager: `pnpm@10.11.1`\n- Builder: `-`\n- User Config: `compatibilityDate`, `modules`\n- Runtime Modules: `@nuxt/test-utils/module@3.19.1`\n- Build Modules: `-`\n```\n\n### Additional information\n\n- [x] Would you be willing to help implement this feature?\n- [ ] Could this feature be implemented as a module?\n\n### Final checks\n\n- [x] Read the [contribution guide](https://nuxt.com/docs/community/contribution).\n- [x] Check existing [discussions](https://github.com/nuxt/nuxt/discussions) and [issues](https://github.com/nuxt/nuxt/issues).",[3018],{"name":3019,"color":3020},"pending triage","5D08F5",1322,"nuxt","test-utils","open","Support Vitest `projects` option for Browser Mode","2025-06-18T13:51:03Z","https://github.com/nuxt/test-utils/issues/1322",0.6437415,{"description":3030,"labels":3031,"number":3033,"owner":3022,"repository":3023,"state":3024,"title":3034,"updated_at":3035,"url":3036,"score":3037},"### Environment\n\n\n\"@nuxt/test-utils\": \"^3.19.2\",\n\"vitest\": \"^3.2.3\"\n\n--\n- Operating System: Windows_NT\n- Node Version: v22.16.0\n- Nuxt Version: 3.17.6\n- CLI Version: 3.25.1\n- Nitro Version: 2.11.13\n- Package Manager: npm@10.9.2\n- Builder: -\n- User Config: runtimeConfig, ssr, alias, compatibilityDate, devtools, css, vite, modules\n- Runtime Modules: @nuxt/test-utils/module@3.19.2, @pinia/nuxt@0.11.1\n- Build Modules: -\n\n### Reproduction\n\nSimilar to [here](https://stackoverflow.com/questions/79537445/not-all-components-impacted-by-coverage).\nIst about the nuxt environment.\nI changed it from `happy-dom` to `nuxt`. Since then it is not coverging pages.\nThe Stackoverflow user had a much simpler set up without projects.\n\n```ts\nimport {\n defineVitestConfig,\n defineVitestProject,\n} from \"@nuxt/test-utils/config\";\nimport vue from \"@vitejs/plugin-vue\";\nimport AutoImport from \"unplugin-auto-import/vite\";\nimport { configDefaults, defineConfig } from \"vitest/config\";\n\n// 1️⃣ Nuxt-specific setup via defineVitestConfig\nconst nuxtConfig = defineVitestConfig({\n test: {\n environment: \"nuxt\",\n globals: true,\n },\n});\n\n// 2️⃣ Full Vitest config using core defineConfig\nexport default defineConfig({\n ...nuxtConfig,\n test: {\n coverage: {\n provider: \"v8\",\n reporter: [\"text\", \"json\", \"html\"],\n reportsDirectory: \"./tests/coverage\",\n exclude: [\n ...(configDefaults.coverage?.exclude ?? []),\n \"**/*.cy.ts\",\n \"**/*.cy.tsx\",\n \"**/cypress/**\",\n \"nuxt.config.ts\",\n \"scripts/**\",\n ],\n thresholds: { statements: 90, branches: 90, functions: 0, lines: 90 },\n },\n\n projects: [\n {\n test: {\n name: \"Server (Node Environment)\",\n include: [\"tests/server/**/*.{test,spec}.ts\"],\n globals: true,\n environment: \"node\",\n },\n plugins: [vue(), AutoImport({ imports: [\"vue\"], dts: true })],\n },\n await defineVitestProject({\n test: {\n name: \"Happy NUXT Environment\",\n include: [\n \"tests/pages/**/*.{test,spec}.ts\",\n \"tests/components/**/*.{test,spec}.ts\",\n \"tests/composables/**/*.{test,spec}.ts\",\n \"tests/utils/**/*.{test,spec}.ts\",\n \"tests/plugins/**/*.{test,spec}.ts\",\n \"tests/layouts/**/*.{test,spec}.ts\",\n \"tests/directives/**/*.{test,spec}.ts\",\n \"tests/mixins/**/*.{test,spec}.ts\",\n \"tests/app.test.ts\",\n \"Tests/error.test.ts\",\n ],\n exclude: [\"tests/server/*.{test,spec}.ts\"],\n globals: true,\n environment: \"nuxt\",\n setupFiles: [\"./tests/setup.ts\"],\n },\n }),\n ],\n },\n});\n```\n\n### Describe the bug\n\nnuxt environment doesn't create coverage for pages\n\n\n\n\n### Additional context\n\nI tried additionally and explicitly adding pages to includes. But it doesn't work.\nPlease, tag me, if it requires to be opened up in a different repository, such as vitest.\n\n### Logs\n\n```shell-script\n\n```",[3032],{"name":3019,"color":3020},1352,"pages are not covered in nuxt environment","2025-07-07T13:56:40Z","https://github.com/nuxt/test-utils/issues/1352",0.6446176,{"description":3039,"labels":3040,"number":3041,"owner":3022,"repository":3042,"state":3043,"title":3044,"updated_at":3045,"url":3046,"score":3047},"Nuxt 3.16.1\n\n```ts\n[8:47:30 PM] ERROR Pre-transform error: fetch failed\n Plugin: nuxt:fonts:font-family-injection\n File: /country/app/assets/css/tailwind.css\n```\n\n\n```ts\n fonts: {\n families: [\n { name: 'Inter', provider: 'google' },\n { name: 'JetBrains Mono', provider: 'google' },\n { name: 'IM Fell English', provider: 'google' },\n { name: 'Pirata One', provider: 'google' },\n {\n name: 'Fira Code',\n provider: 'google',\n weights: [400, 500],\n },\n ],\n },\n```",[],574,"fonts","closed","Pre-transform error: fetch failed","2025-04-21T09:34:26Z","https://github.com/nuxt/fonts/issues/574",0.45953694,{"description":3049,"labels":3050,"number":3056,"owner":3022,"repository":3022,"state":3043,"title":3057,"updated_at":3058,"url":3059,"score":3060},"### Environment\n\n- Operating System: Darwin\r\n- Node Version: v18.20.1\r\n- Nuxt Version: 3.6.5\r\n- Nitro Version: 2.5.2\r\n- Package Manager: yarn@4.1.0\r\n- Builder: vite\r\n- User Config: srcDir, buildDir, modules, ssr, nitro, serverHandlers, css, components, imports, build, builder, typescript, vue, hooks\r\n- Runtime Modules: @nuxt/test-utils/module@3.12.0\r\n- Build Modules: -\n\n### Reproduction\n\nUnfortunately I could not reproduce this behaviour in a fresh repo.\n\n### Describe the bug\n\nUsing `defineVitestConfig` from `@nuxt/test-utils` gives me some errors on random(?) test files located in a specific folder (`./src/plugins/` in this case). It seems that vitest doesn't find those tests inside this directory (`No test suite found in file /omniweb/gsd/src/plugins/frontend-commons.spec.ts`). I tried to place a simple `test.spec.ts` inside with a basic test but it doesn't pick that up either.\r\nHowever if I move those test files to another directory at the same level it runs those test. If I rename the folder to `plugins` it again does not run those test files...\r\n\r\nI really can't imagine what's going on here. Are there some forbidden path patterns for some reason?\n\n### Additional context\n\n_No response_\n\n### Logs\n\n_No response_",[3051,3054],{"name":3052,"color":3053},"3.x","29bc7f",{"name":3019,"color":3055},"E99695",26898,"`defineVitestConfig` from `@nuxt/test-utils` is not a drop-in replacement for `defineConfig` from `vite` (`No test suite found in file`)","2024-04-23T07:13:27Z","https://github.com/nuxt/nuxt/issues/26898",0.61502963,{"description":3062,"labels":3063,"number":3066,"owner":3022,"repository":3022,"state":3043,"title":3067,"updated_at":3068,"url":3069,"score":3070},"### Environment\r\n\r\n- Operating System: `Linux`\r\n- Node Version: `v18.9.0`\r\n- Nuxt Version: `3.0.0-rc.11`\r\n- Nitro Version: `0.5.4`\r\n- Package Manager: `npm@8.19.1`\r\n- Builder: `vite`\r\n- User Config: `build`, `css`, `modules`, `runtimeConfig`\r\n- Runtime Modules: `@nuxt/image-edge@1.0.0-27716498.4c23770`\r\n- Build Modules: `-`\r\n\r\n### Reproduction\r\n\r\nApologies, cannot provide due to work policies at my organization.\r\n\r\n### Describe the bug\r\n\r\nBasically I cannot find any way to install the Nuxt plugins I've used in my project while setting up the Vitest config for testing.\r\nI've tried to include the paths to my plugins in setupFiles in vitest.config.ts but doing that gave me an error like - Package import specifier \"#build/app.config.mjs\" is not defined in package. Currently this is my config - \r\n\r\n```\r\n// vitest.config.ts\r\n\r\nimport Vue from '@vitejs/plugin-vue';\r\nimport { resolve } from 'path';\r\nimport fs from 'fs'\r\nimport { defineConfig } from 'vitest/config';\r\nimport AutoImport from 'unplugin-auto-import/vite'\r\n\r\nconst NuxtTsConfig = (fs.readFileSync('./.nuxt/tsconfig.json')).toString()\r\nconst tsConfigFormated = JSON.parse(NuxtTsConfig\r\n .replace(/\\\\\"|\"(?:\\\\\"|[^\"])*\"|(\\/\\/.*|\\/\\*[\\s\\S]*?\\*\\/)/g, (m, g) => g ? '' : m))\r\n\r\nconst r = (p: string) => resolve(__dirname, p)\r\n\r\nexport const alias: Record\u003Cstring, string> = {}\r\n\r\nObject.entries(tsConfigFormated.compilerOptions.paths)\r\n .forEach(([key, value]) => {\r\n alias[key] = r(value[0])\r\n })\r\n\r\nexport default defineConfig({\r\n root: '.',\r\n esbuild: {\r\n tsconfigRaw: '{}',\r\n },\r\n plugins: [\r\n Vue(),\r\n AutoImport({\r\n imports: [\r\n 'vue'\r\n ],\r\n dirs: [\r\n './composables',\r\n './components'\r\n ],\r\n dts: true\r\n })\r\n ],\r\n test: {\r\n globals: true,\r\n environment: 'jsdom',\r\n deps: {\r\n inline: [/@nuxt\\/test-utils-edge/],\r\n },\r\n setupFiles: ['./plugins/some-plugin.ts']\r\n },\r\n resolve: {\r\n alias: {\r\n ...alias,\r\n '#imports': r('./.nuxt/imports.d.ts')\r\n }\r\n }\r\n})\r\n```\r\nAnd this is one of the sample tests I tried to ran -\r\n\r\n```\r\n// login.test.ts\r\n\r\nimport { render, screen } from \"@testing-library/vue\";\r\nimport Login from '../pages/login/index.vue'\r\n\r\ndescribe('Login', async () => {\r\n const text = 'Test'\r\n it('should be span element', async () => {\r\n render(Login)\r\n const elem = await screen.findByText(text)\r\n console.log(elem)\r\n expect(elem.nodeName).toBe('SPAN')\r\n })\r\n})\r\n```\r\n@danielroe @pi0 \r\n\r\nThanks\r\n\r\n### Additional context\r\n\r\n_No response_\r\n\r\n### Logs\r\n\r\n_No response_",[3064,3065],{"name":3052,"color":3053},{"name":3019,"color":3055},15004,"No way to install plugins with Vitest in Nuxt 3","2023-12-02T00:33:54Z","https://github.com/nuxt/nuxt/issues/15004",0.6371025,{"description":3072,"labels":3073,"number":3081,"owner":3022,"repository":3022,"state":3043,"title":3082,"updated_at":3083,"url":3084,"score":3085},"### Environment\n\nRootDir: /Users/dev02/dev/temporario/app-nuxt-3\r\n------------------------------\r\n- Operating System: `Darwin`\r\n- Node Version: `v16.14.2`\r\n- Nuxt Version: `3.0.0`\r\n- Nitro Version: `1.0.0`\r\n- Package Manager: `yarn@1.22.10`\r\n- Builder: `vite`\r\n- User Config: `ssr`, `app`, `css`, `windicss`, `build`, `modules`, `experimental`, `components`, `vite`, `runtimeConfig`, `intlify`, `vueuse`, `content`\r\n- Runtime Modules: `@intlify/nuxt3@0.2.4`, `@pinia/nuxt@0.4.6`, `@nuxt/content@2.2.2`, `@vueuse/nuxt@9.6.0`, `nuxt-windicss@2.5.5`, `nuxt-icon@0.1.8`\r\n- Build Modules: `-`\r\n------------------------------\n\n### Reproduction\n\n// app-nuxt-3/test/hoje.test.js\r\n\r\nimport { fileURLToPath } from 'node:url'\r\nimport { describe, expect, it } from 'vitest'\r\nimport { isWindows } from 'std-env'\r\nimport { setup, fetch, $fetch, startServer, createPage, url } from '@nuxt/test-utils'\r\n\r\nawait setup({\r\n rootDir: fileURLToPath(new URL('../../app-nuxt-3', import.meta.url)),\r\n server: true,\r\n browser: false,\r\n setupTimeout: (isWindows ? 240 : 120) * 1000\r\n})\r\n\r\ndescribe('pages', () => {\r\n it('render index', async () => {\r\n const html = await $fetch('/')\r\n expect(html).toContain('Fundação de Esportes DEV')\r\n })\r\n\r\n\r\n\n\n### Describe the bug\n\nHere are the links to the documentation and the example I took to make mine.\r\nhttps://nuxt.com/docs/getting-started/testing\r\nhttps://github.com/nuxt/framework/tree/main/test\r\n\r\nThe issue I'm having is the app is telling me the Url must be from the schema file. I'm in doubt if the Url is wrong when pointing to the application or if the scheme he wants to say is something else. I can't find any examples on the internet that help me.\r\nNote: Remembering that I configured Vitest and use it normally, including together with Pinia. The real problem is when I started testing the Nuxt components themselves. I haven't even started yet.\r\n\r\nError picture:\r\n\r\n\u003Cimg width=\"643\" alt=\"Captura de Tela 2023-01-09 às 10 42 12\" src=\"https://user-images.githubusercontent.com/83841469/211322216-b68c08fa-1f02-4793-9a03-bd8e275439c1.png\">\r\n\n\n### Additional context\n\nIt's my first time writing a bug (I've always been able to solve it by searching), so forgive me if it's not good enough.\n\n### Logs\n\n_No response_",[3074,3075,3078],{"name":3052,"color":3053},{"name":3076,"color":3077},"needs reproduction","FBCA04",{"name":3079,"color":3080},"⛔️ can be closed","484893",12368,"Problem starting @nuxt/test-utils with URL","2023-02-07T07:10:45Z","https://github.com/nuxt/nuxt/issues/12368",0.6398852,{"description":3087,"labels":3088,"number":3092,"owner":3022,"repository":3023,"state":3043,"title":3093,"updated_at":3094,"url":3095,"score":3096},"### Environment\r\n\r\n- Operating System: `Linux`\r\n- Node Version: `v16.14.2`\r\n- Nuxt Version: `3.0.0-rc.8`\r\n- Package Manager: `npm@7.17.0`\r\n- Builder: `vite`\r\n- User Config: `modules`\r\n- Runtime Modules: `vite-plugin-vue-type-imports/nuxt`\r\n- Build Modules: `-`\r\n\r\n### Reproduction\r\n\r\n#### How to recreate\r\n\r\nFor every link:\r\n\r\n1. Open a link.\r\n2. Wait for a development server is start and the Nuxt Welcome page is loaded.\r\n4. Press \u003Ckbd>Ctrl\u003C/kbd> + \u003Ckbd>C\u003C/kbd> in Terminal.\r\n5. Run `npm test`.\r\n\r\n#### Broken\r\n\r\nhttps://stackblitz.com/edit/github-owtwqh-82agcd?file=nuxt.config.ts,modules%2Fvite-plugin-vue-type-imports.ts,app.vue\r\n\r\n##### Load a bundled Nuxt module from the `node_modules` directory\r\n\r\n```ts\r\nexport default defineNuxtConfig({\r\n modules: [\r\n 'vite-plugin-vue-type-imports/nuxt',\r\n ],\r\n});\r\n```\r\n\r\n#### Working\r\n\r\nhttps://stackblitz.com/edit/github-owtwqh-dyj8f8?file=nuxt.config.ts,modules%2Fvite-plugin-vue-type-imports.ts,app.vue\r\n\r\n##### Load a local Nuxt module from the `modules/` directory\r\n\r\n```ts\r\nexport default defineNuxtConfig({\r\n modules: [\r\n '~/modules/vite-plugin-vue-type-imports.ts',\r\n ],\r\n});\r\n```\r\n\r\n### Describe the bug\r\n\r\nThe `vite-plugin-vue-type-imports/nuxt` module added in `nuxt.config.ts` is:\r\n\r\n* works when loaded via `npm run dev`;\r\n* broken if loaded via `npm test` (`nuxt test` or `vitest` with `@nuxt/test-utils-edge`).\r\n\r\n### Additional context\r\n\r\nThe [same Nuxt module code](https://github.com/wheatjs/vite-plugin-vue-type-imports/blob/370fcea9c7a09a0961bdf6e29b0795963034eb1e/src/nuxt.ts) is works with `npm test` if copy-pasted and loaded as a local plugin from the `modules/` directory.\r\n\r\n### Logs\r\n\r\n```shell\r\nERROR TypeError: Invalid URL 22:18:50\r\n\r\n ❯ TypeError.get https:/github-owtwqh-82agcd.w.staticblitz.com/blitz.df64f655701fde45529fa8e152b3842072335b47.js:6:292488\r\n 22:18:50\r\n⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯\r\nSerialized Error: { 22:18:50\r\n \"code\": \"ERR_INVALID_URL\",\r\n \"input\": \"//\",\r\n}\r\n```\r\n",[3089],{"name":3090,"color":3091},"bug","d73a4a",345,"Vitest with `@nuxt/test-utils-edge` breaks imported `vite-plugin-vue-type-imports/nuxt` module, but works if same module code is recreated locally","2023-12-02T00:33:10Z","https://github.com/nuxt/test-utils/issues/345",0.64240307,{"description":3087,"labels":3098,"number":3099,"owner":3022,"repository":3023,"state":3043,"title":3093,"updated_at":3100,"url":3101,"score":3102},[],429,"2023-12-02T00:13:09Z","https://github.com/nuxt/test-utils/issues/429",0.64538836,{"description":3104,"labels":3105,"number":3108,"owner":3022,"repository":3022,"state":3043,"title":3109,"updated_at":3110,"url":3111,"score":3112},"### Environment\n\nNuxi 3.0.0-rc.10 14:35:32\r\nRootDir: /home/workspace/app/packages/app/web 14:35:33\r\nNuxt project info: 14:35:33\r\n\r\n------------------------------\r\n- Operating System: `Linux`\r\n- Node Version: `v18.9.1`\r\n- Nuxt Version: `3.0.0-rc.10`\r\n- Nitro Version: `0.5.3`\r\n- Package Manager: `npm@8.19.1`\r\n- Builder: `vite`\r\n- User Config: `-`\r\n- Runtime Modules: `-`\r\n- Build Modules: `-`\r\n------------------------------\n\n### Reproduction\n\n`import { createBackendConfig } from '@mypath/common-api/config/backendConfig'` in your `nuxt.config.ts`\n\n### Describe the bug\n\n Will result in:\r\n\r\n`ERROR Cannot start nuxt: Cannot find module '@mypath/common-api/config/backendConfig'`\r\n\r\nWhich is obvious because, it doesn't know `@mypath` in the context of `nuxt.config.ts`\r\n\r\nIn Vite I can define this for `vite.config.ts` in `tsconfig.node.json` because this tsconfig is responsible for the `vite.config.ts` due to ` \"include\": [\"vite.config.ts\", \"./vite.ts\"],`\r\n\r\nHow do I do in nuxt environment for `nuxt.config.ts` ? \n\n### Additional context\n\n_No response_\n\n### Logs\n\n_No response_",[3106,3107],{"name":3052,"color":3053},{"name":3019,"color":3055},15202,"how to use imports in nuxt.config.ts via paths ?","2023-01-19T17:46:10Z","https://github.com/nuxt/nuxt/issues/15202",0.6540424,{"labels":3114,"number":3118,"owner":3022,"repository":3022,"state":3043,"title":3119,"updated_at":3120,"url":3121,"score":3122},[3115,3116,3117],{"name":3052,"color":3053},{"name":3019,"color":3055},{"name":3076,"color":3077},14451,"createTest from @nuxt/test-utils-edge can't load nuxt","2023-01-19T17:35:34Z","https://github.com/nuxt/nuxt/issues/14451",0.6542795,["Reactive",3124],{},["Set"],["ShallowReactive",3127],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fyjQ4UOqllLppjTOrHYDD3gXkn4wpiVfn5S8zyxF9M9I":-1},"/nuxt/test-utils/574"]