\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).",[3172],{"name":3173,"color":3174},"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.6268235,{"description":3184,"labels":3185,"number":3187,"owner":3176,"repository":3177,"state":3178,"title":3188,"updated_at":3189,"url":3190,"score":3191},"### 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```",[3186],{"name":3173,"color":3174},1352,"pages are not covered in nuxt environment","2025-07-07T13:56:40Z","https://github.com/nuxt/test-utils/issues/1352",0.67468965,{"description":3193,"labels":3194,"number":3200,"owner":3176,"repository":3176,"state":3201,"title":3202,"updated_at":3203,"url":3204,"score":3205},"### Environment\n\n- Operating System: Windows_NT\r\n- Node Version: v18.16.1\r\n- Nuxt Version: 3.6.5\r\n- Nitro Version: 2.5.2\r\n- Package Manager: npm@9.8.1\r\n- Builder: vite\r\n- User Config: -\r\n- Runtime Modules: -\r\n- Build Modules: -\n\n### Reproduction\n\nthe reproduction is [here](https://stackblitz.com/edit/github-h5v6xs?file=src%2Fmodule.ts)\r\nplease run `npm dev:prepare` then `npm run prepack`\n\n### Describe the bug\n\nI have followed the instruction to expose module options using defu package as it is advised [here](https://nuxt.com/docs/guide/going-further/modules#exposing-options-to-runtime).\r\nThe module works as intended in development, but in build (after running npm run prepack): I get the following warning :\r\n inline implicit external defu .\r\n\r\n\n\n### Additional context\n\nwhen I ran` npx nuxi init -t module my-module` then npm install I got a peerdependency conflic\r\n\r\n```\r\nnpm ERR! While resolving: @nuxt/test-utils@3.6.5\r\nnpm ERR! Found: vitest@0.34.2\r\nnpm ERR! node_modules/vitest\r\nnpm ERR! dev vitest@\"^0.34.1\" from the root project\r\nnpm ERR! \r\nnpm ERR! Could not resolve dependency:\r\nnpm ERR! peerOptional vitest@\"^0.30.0 || ^0.31.0 || ^0.32.0 || ^0.33.0\" from @nuxt/test-utils@3.6.5\r\nnpm ERR! node_modules/@nuxt/test-utils\r\nnpm ERR! dev @nuxt/test-utils@\"^3.6.5\" from the root project\r\nnpm ERR! \r\nnpm ERR! Conflicting peer dependency: vitest@0.33.0\r\nnpm ERR! node_modules/vitest\r\nnpm ERR! peerOptional vitest@\"^0.30.0 || ^0.31.0 || ^0.32.0 || ^0.33.0\" from @nuxt/test-utils@3.6.5\r\nnpm ERR! node_modules/@nuxt/test-utils\r\nnpm ERR! dev @nuxt/test-utils@\"^3.6.5\" from the root project\r\nnpm ERR! \r\nnpm ERR! Fix the upstream dependency conflict, or retry\r\nnpm ERR! this command with --force, or --legacy-peer-deps\r\nnpm ERR! to accept an incorrect (and potentially broken) dependency resolution.\r\nnpm ERR! \r\nnpm ERR! See /home/runner/.npm/eresolve-report.txt for a full report.\r\n```\r\n\r\n so I used npm install --force\n\n### Logs\n\n_No response_",[3195,3198],{"name":3196,"color":3197},"3.x","29bc7f",{"name":3173,"color":3199},"E99695",22749,"closed","I'm getting a warning when I try to build a module","2024-11-18T09:29:56Z","https://github.com/nuxt/nuxt/issues/22749",0.64284486,{"description":3207,"labels":3208,"number":3214,"owner":3176,"repository":3176,"state":3201,"title":3215,"updated_at":3216,"url":3217,"score":3218},"### Environment\n\n```\r\n- Operating System: `Darwin`\r\n- Node Version: `v16.16.0`\r\n- Nuxt Version: `3.0.0-rc.11`\r\n- Nitro Version: `0.5.4`\r\n- Package Manager: `yarn@1.22.11`\r\n- Builder: `vite`\r\n```\r\n\r\nThough I have also tested with rc 10, 8, 5, & 4\n\n### Reproduction\n\nThis is fairly short so ill avoid reproduction unless theres a strong need\r\n\r\nFrom a fresh Nuxt 3 Project:\r\n\r\n```json\r\n// package.json\r\n\r\n{\r\n \"scripts\": {\r\n ...\r\n \"build\": \"nuxt build\",\r\n \"test\": \"vitest run\"\r\n },\r\n \"devDependencies\": {\r\n \"nuxt\": \"3.0.0-rc.11\"\r\n },\r\n \"dependencies\": {\r\n \"@nuxt/test-utils\": \"3.0.0-rc.11\",\r\n \"vitest\": \"^0.23.4\"\r\n }\r\n}\r\n```\r\n\r\n```ts\r\n// vite.config.ts\r\n\r\nimport { defineConfig } from \"vitest/config\";\r\n\r\nexport default defineConfig({\r\n test: {\r\n globals: true,\r\n },\r\n});\r\n```\r\n\r\n```html\r\n// pages/index.vue\r\n\r\n\u003Ctemplate>\r\n \u003Ch1>Hello World!\u003C/h1>\r\n\u003C/template>\r\n```\r\n\r\n```ts\r\n// pages/index.spec.ts\r\n\r\nimport { describe, test, expect } from 'vitest'\r\nimport { setup, $fetch } from '@nuxt/test-utils'\r\n\r\ndescribe('My test', async () => {\r\n await setup({\r\n runner: 'vitest',\r\n })\r\n\r\n test('my test', () => {\r\n const html = $fetch('/')\r\n\r\n expect(html).toContain('Hello World!')\r\n })\r\n})\r\n```\n\n### Describe the bug\n\nDuring the `beforeAll` section of the `setup` in my test it crashes with this result:\r\n\r\n```\r\nError: [vite]: Rollup failed to resolve import \"jest\" from \"node_modules/@nuxt/test-utils/dist/index.mjs\".\r\nThis is most likely unintended because it can break your application at runtime.\r\nIf you do want to externalize this module explicitly add it to\r\n`build.rollupOptions.external`\r\n```\r\n\r\nThis is strange since the runner is clearly `vitest`, so it shouldnt be trying to import jest.\r\n\r\nTook a brief look at the `index.mjs` and my `hooks.ctx.options.runner` is properly recieving `vitest`.\r\n\r\nThe error ends with:\r\n\r\n```\r\n Segmentfault Error Detected \r\n FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal.\r\n Refer to https://github.com/nodejs/node/issues/42407\r\n```\n\n### Additional context\n\nI havent been able to find a solid working example to base my own code. I was hoping this issue was just the RC version that I was using, but so far I havent had any luck with changing it. \r\n\r\nI tried cloning the `nuxt-ionic` repository as I saw it was on a later RC version and using vitest, however even with that I ran into issues. Is there a good working example I can be pointed in the direction of?\n\n### Logs\n\n```shell\n$ vitest run\r\n\r\n RUN v0.23.4 /Users/*********************/test-utils\r\n\r\n ❯ pages/index.spec.ts (1)\r\n 1: 0x103ab6ef5 node::Abort() (.cold.1) [/Users/*********************/.nvm/versions/node/v16.16.0/bin/node]\r\n ❯ pages/index.spec.ts (1) 4104ms\r\n ❯ My test (1) 4103ms\r\n ⠙ [ beforeAll ]\r\n · my test\r\n\r\n 2: 0x1027aa869 node::Abort() [/Users/*********************/.nvm/versions/node/v16.16.0/bin/node]\r\n 3: 0x1027aa9df node::OnFatalError(char const*, char const*) [/Users/*********************/.nvm/versions/node/v16.16.0/bin/node]\r\n⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯\r\n\r\n FAIL pages/index.spec.ts > My test\r\n 4: 0x10292ed00 v8::V8::ToLocalEmpty() [/Users/*********************/.nvm/versions/node/v16.16.0/bin/node]\r\nError: [vite]: Rollup failed to resolve import \"jest\" from \"node_modules/@nuxt/test-utils/dist/index.mjs\".\r\nThis is most likely unintended because it can break your application at runtime.\r\nIf you do want to externalize this module explicitly add it to\r\n`build.rollupOptions.external`\r\n ❯ onRollupWarning node_modules/vite/dist/node/chunks/dep-6b3a5aff.js:45908:19\r\n 5: 0x1027a596f node::fs::FSReqPromise\u003Cnode::AliasedBufferBase\u003Cdouble, v8::Float64Array, void> >::Resolve(v8::Local\u003Cv8::Value>) [/Users/*********************/.nvm/versions/node/v16.16.0/bin/node]\r\n ❯ onwarn node_modules/vite/dist/node/chunks/dep-6b3a5aff.js:45706:13\r\n ❯ Object.onwarn node_modules/vite/node_modules/rollup/dist/es/shared/rollup.js:23225:13\r\n ❯ ModuleLoader.handleResolveId node_modules/vite/node_modules/rollup/dist/es/shared/rollup.js:22352:26\r\n ❯ ModuleLoader.resolveDynamicImport node_modules/vite/node_modules/rollup/dist/es/shared/rollup.js:22404:120\r\n ❯ async file:/Users/*********************/test-utils/node_modules/vite/node_modules/rollup/dist/es/shared/rollup.js:22299:32\r\n\r\n⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯\r\n 6: 0x1027afa40 node::fs::AfterStat(uv_fs_s*) [/Users/*********************/.nvm/versions/node/v16.16.0/bin/node]\r\n 7: 0x103176598 uv__work_done [/Users/*********************/.nvm/versions/node/v16.16.0/bin/node]\r\n 8: 0x10317b75b uv__async_io [/Users/*********************/.nvm/versions/node/v16.16.0/bin/node]\r\n 9: 0x10318f54b uv__io_poll [/Users/*********************/.nvm/versions/node/v16.16.0/bin/node]\r\nSerialized Error: Object {\r\n \"watchFiles\": [Array],\r\n}\r\n10: 0x10317bce1 uv_run [/Users/*********************/.nvm/versions/node/v16.16.0/bin/node]\r\n\r\n\r\n⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯\r\n\r\n11: 0x1026dbf9f node::SpinEventLoop(node::Environment*) [/Users/*********************/.nvm/versions/node/v16.16.0/bin/node]\r\nTest Files 1 failed (1)\r\n Tests (1)\r\n12: 0x102852cae node::worker::Worker::Run() [/Users/*********************/.nvm/versions/node/v16.16.0/bin/node]\r\n13: 0x1028566a2 node::worker::Worker::StartThread(v8::FunctionCallbackInfo\u003Cv8::Value> const&)::$_3::__invoke(void*) [/Users/*********************/.nvm/versions/node/v16.16.0/bin/node]\r\n14: 0x7ff8042ef4e1 _pthread_start [/usr/lib/system/libsystem_pthread.dylib]\r\n15: 0x7ff8042eaf6b thread_start [/usr/lib/system/libsystem_pthread.dylib]\r\n\r\n Segmentfault Error Detected \r\n FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal.\r\n Refer to https://github.com/nodejs/node/issues/42407\r\n\r\nIt seems to be an upstream bug of Node.js. To improve the test stability,\r\nyou could pass --segfault-retry=3 or set env VITEST_SEGFAULT_RETRY=3 to\r\nhave Vitest auto retries on flaky segfaults.\r\n\r\nerror Command failed with exit code 1.\n```\n",[3209,3210,3211],{"name":3196,"color":3197},{"name":3173,"color":3199},{"name":3212,"color":3213},"needs reproduction","FBCA04",15073,"Unable to get a running env with `nuxt/test-utils`","2023-01-19T17:44:36Z","https://github.com/nuxt/nuxt/issues/15073",0.6481372,{"labels":3220,"number":3222,"owner":3176,"repository":3176,"state":3201,"title":3223,"updated_at":3224,"url":3225,"score":3226},[3221],{"name":3173,"color":3199},28608,"type checking error for globally imported vitest globals","2024-08-20T10:23:47Z","https://github.com/nuxt/nuxt/issues/28608",0.6517884,{"description":3228,"labels":3229,"number":3232,"owner":3176,"repository":3176,"state":3201,"title":3233,"updated_at":3234,"url":3235,"score":3236},"### 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_",[3230,3231],{"name":3196,"color":3197},{"name":3173,"color":3199},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.6545272,{"description":3238,"labels":3239,"number":3242,"owner":3176,"repository":3176,"state":3201,"title":3243,"updated_at":3244,"url":3245,"score":3246},"### Environment\n\n------------------------------\r\n- Operating System: `Darwin`\r\n- Node Version: `v17.9.1`\r\n- Nuxt Version: `3.0.0-rc.12`\r\n- Nitro Version: `0.6.0`\r\n- Package Manager: `npm@8.11.0`\r\n- Builder: `vite`\r\n- User Config: `-`\r\n- Runtime Modules: `-`\r\n- Build Modules: `-`\r\n------------------------------\n\n### Reproduction\n\nhttps://github.com/asmerkin/nuxt3-vitest-issue\r\n\r\nJust install with `npm install` and then use `npm run test` to start vitest.\n\n### Describe the bug\n\nWhen starting tests, it fails, and it seems to be looking for `jest` despite we´re using `vitest` here. \n\n### Additional context\n\n_No response_\n\n### Logs\n\n```shell\nFAIL pages/index.spec.js > Example Test\r\n 4: 0x104b13778 node::fs::FSReqAfterScope::~FSReqAfterScope() [/Users/asmerkin/.nvm/versions/node/v17.9.1/bin/node]\r\n 5: 0x104b13c30 node::fs::AfterOpenFileHandle(uv_fs_s*) [/Users/asmerkin/.nvm/versions/node/v17.9.1/bin/node]\r\nError: [vite]: Rollup failed to resolve import \"jest\" from \"node_modules/@nuxt/test-utils-edge/dist/index.mjs\".\r\nThis is most likely unintended because it can break your application at runtime.\r\nIf you do want to externalize this module explicitly add it to\r\n`build.rollupOptions.external`\r\n ❯ onRollupWarning node_modules/vite/dist/node/chunks/dep-4da11a5e.js:45916:19\r\n ❯ onwarn node_modules/vite/dist/node/chunks/dep-4da11a5e.js:45714:13\r\n ❯ Object.onwarn node_modules/vite/node_modules/rollup/dist/es/shared/rollup.js:23225:13\r\n ❯ ModuleLoader.handleResolveId node_modules/vite/node_modules/rollup/dist/es/shared/rollup.js:22352:26\r\n ❯ ModuleLoader.resolveDynamicImport node_modules/vite/node_modules/rollup/dist/es/shared/rollup.js:22404:120\r\n ❯ async file:/Users/asmerkin/Workspace/intrepits/test-vitest/node_modules/vite/node_modules/rollup/dist/es/shared/rollup.js:22299:32\r\n 6: 0x1053a9198 uv__work_done [/Users/asmerkin/.nvm/versions/node/v17.9.1/bin/node]\r\n\r\n⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯\r\n 7: 0x1053ac934 uv__async_io [/Users/asmerkin/.nvm/versions/node/v17.9.1/bin/node]\r\n 8: 0x1053be6ac uv__io_poll [/Users/asmerkin/.nvm/versions/node/v17.9.1/bin/node]\r\n 9: 0x1053acdc4 uv_run [/Users/asmerkin/.nvm/versions/node/v17.9.1/bin/node]\r\nSerialized Error: Object {\r\n \"watchFiles\": [Array],\r\n}\n```\n",[3240,3241],{"name":3196,"color":3197},{"name":3173,"color":3199},15315,"Issues running Vitest within Nuxt3","2023-01-30T12:17:13Z","https://github.com/nuxt/nuxt/issues/15315",0.6551736,{"description":3248,"labels":3249,"number":3251,"owner":3176,"repository":3176,"state":3201,"title":3252,"updated_at":3253,"url":3254,"score":3255},"### Environment\n\n- Operating System: `Darwin`\n- Node Version: `v22.17.1`\n- Nuxt Version: `4.0.2`\n- CLI Version: `3.27.0`\n- Nitro Version: `2.12.4`\n- Package Manager: `npm@10.9.2`\n- Builder: `-`\n- User Config: `compatibilityDate`, `devtools`, `modules`\n- Runtime Modules: `@nuxt/test-utils/module@3.19.2`\n- Build Modules: `-`\n\n\n(I was also able to reproduce it on stackblitz)\n\n### Reproduction\n\n[A minimal repro](https://github.com/Zachiah/testing-nuxt2). Just run `npx vitest`. I've had to run it close to 10 times before getting the error sometimes. It is very inconsistent. \n\n### Describe the bug\nJust followed the steps from [the nuxt docs on testing](https://nuxt.com/docs/4.x/getting-started/testing) on a newly generated template. Running `npx vitest` sometimes works just fine and other times spits out the error: \"AggregateError: Failed to initialize projects. There were errors during projects setup. See below for more details.\"\n\n### Additional context\n\n_No response_\n\n### Logs\n\n```shell-script\n\n```",[3250],{"name":3173,"color":3199},32814,"Testing is broken when following docs","2025-08-31T20:49:04Z","https://github.com/nuxt/nuxt/issues/32814",0.6582472,{"description":3257,"labels":3258,"number":3261,"owner":3176,"repository":3176,"state":3201,"title":3262,"updated_at":3263,"url":3264,"score":3265},"### Environment\r\n\r\n- Operating System: `Darwin`\r\n- Node Version: `v19.9.0`\r\n- Nuxt Version: `3.7.3`\r\n- CLI Version: `3.8.4`\r\n- Nitro Version: `2.6.3`\r\n- Package Manager: `yarn@1.22.19`\r\n- Builder: `-`\r\n- User Config: `css`, `build`, `devtools`, `modules`, `runtimeConfig`, `postcss`\r\n- Runtime Modules: `nuxt-icon@0.4.2`\r\n- Build Modules: `-`\r\n\r\n### Reproduction\r\n\r\nCreate a test file like this:\r\n\r\n```import { assert, describe, expect, it } from 'vitest'\r\nimport { setup, $fetch } from '@nuxt/test-utils'\r\n\r\n\r\ndescribe('suite name', async () => {\r\n await setup({})\r\n\r\n it('foo', () => {\r\n expect(1 + 1).toEqual(2)\r\n expect(true).to.be.true\r\n })\r\n\r\n it('bar', () => {\r\n assert.equal(Math.sqrt(4), 2)\r\n })\r\n\r\n it('snapshot', () => {\r\n expect({ foo: 'bar' }).toMatchSnapshot()\r\n })\r\n})\r\n```\r\n\r\nAs soon as you call `await setup({})` it crashes the test runner\r\n\r\n### Describe the bug\r\n\r\n FAIL tests/index.spec.ts > suite name\r\nError: Invariant violation: \"new TextEncoder().encode(\"\") instanceof Uint8Array\" is incorrectly false\r\n\r\nThis indicates that your JavaScript environment is broken. You cannot use\r\nesbuild in this environment because esbuild relies on this invariant. This\r\nis not a problem with esbuild. You need to fix your environment instead.\r\n\r\n### Additional context\r\n\r\n_No response_\r\n\r\n### Logs\r\n\r\n_No response_",[3259,3260],{"name":3196,"color":3197},{"name":3173,"color":3199},23261,"Vitest issue","2023-09-18T13:25:08Z","https://github.com/nuxt/nuxt/issues/23261",0.6626071,{"description":3267,"labels":3268,"number":3270,"owner":3176,"repository":3177,"state":3201,"title":3271,"updated_at":3272,"url":3273,"score":3274},"### Environment\n\n- Operating System: `Linux`\n- Node Version: `v22.14.0`\n- Nuxt Version: `4.0.2`\n- CLI Version: `3.27.0`\n- Nitro Version: `2.12.4`\n- Package Manager: `yarn@1.22.22`\n- Builder: `-`\n- User Config: `-`\n- Runtime Modules: `-`\n- Build Modules: `-`\n\n\n### Reproduction\n\nhttps://stackblitz.com/edit/github-rh3mlpir\n\n### Describe the bug\n\nSince I updated my module's nuxt version to `4.0.2` I can't run my tests anymore.\nLocally I get this error\n```\n➜ shared git:(dependabot/npm_and_yarn/nuxt-4.0.2) yarn test\nyarn run v1.22.22\n$ vitest run\nfailed to load config from /home/joenn/code/leexi/shared/vitest.config.ts\n\n⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Startup Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯\nAggregateError: Failed to initialize projects. There were errors during projects setup. See below for more details.\n at resolveProjects (file:///home/joenn/code/leexi/shared/node_modules/vitest/dist/chunks/cli-api.BkDphVBG.js:7486:27)\n at async Vitest._setServer (file:///home/joenn/code/leexi/shared/node_modules/vitest/dist/chunks/cli-api.BkDphVBG.js:9319:20)\n at async BasicMinimalPluginContext.handler (file:///home/joenn/code/leexi/shared/node_modules/vitest/dist/chunks/cli-api.BkDphVBG.js:10169:6)\n at async _createServer (file:///home/joenn/code/leexi/shared/node_modules/vite/dist/node/chunks/dep-BHkUv4Z8.js:28570:86)\n at async createViteServer (file:///home/joenn/code/leexi/shared/node_modules/vitest/dist/chunks/cli-api.BkDphVBG.js:6911:17)\n at async createVitest (file:///home/joenn/code/leexi/shared/node_modules/vitest/dist/chunks/cli-api.BkDphVBG.js:10202:17)\n at async prepareVitest (file:///home/joenn/code/leexi/shared/node_modules/vitest/dist/chunks/cli-api.BkDphVBG.js:10541:14)\n at async startVitest (file:///home/joenn/code/leexi/shared/node_modules/vitest/dist/chunks/cli-api.BkDphVBG.js:10488:14)\n at async start (file:///home/joenn/code/leexi/shared/node_modules/vitest/dist/chunks/cac.Cb-PYCCB.js:1412:15)\n at async CAC.run (file:///home/joenn/code/leexi/shared/node_modules/vitest/dist/chunks/cac.Cb-PYCCB.js:1391:2) {\n [errors]: [\n Error: Nuxt instance is unavailable!\n at useNuxt (file:///home/joenn/code/leexi/shared/node_modules/@nuxt/vite-builder/node_modules/@nuxt/kit/dist/index.mjs:43:11)\n at useNitro (file:///home/joenn/code/leexi/shared/node_modules/@nuxt/vite-builder/node_modules/@nuxt/kit/dist/index.mjs:795:16)\n at useResolveFromPublicAssets (file:///home/joenn/code/leexi/shared/node_modules/@nuxt/vite-builder/dist/index.mjs:666:17)\n at PublicDirsPlugin (file:///home/joenn/code/leexi/shared/node_modules/@nuxt/vite-builder/dist/index.mjs:573:39)\n at bundle (file:///home/joenn/code/leexi/shared/node_modules/@nuxt/vite-builder/dist/index.mjs:1662:11)\n at async bundle (file:///home/joenn/code/leexi/shared/node_modules/nuxt/dist/index.mjs:7275:5)\n at async build (file:///home/joenn/code/leexi/shared/node_modules/nuxt/dist/index.mjs:7135:3)\n ]\n}\n\n\n\nerror Command failed with exit code 1.\ninfo Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\n```\n\n---\n\nIn the reproduction a similar error can be found when running `yarn test`\n```\n~/projects/bnmijrqrzb.github 13s\n❯ yarn test\nyarn run v1.22.19\n$ vitest run\n(node:399) ExperimentalWarning: WASI is an experimental feature and might change at any time\n(Use `node --trace-warnings ...` to show where the warning was created)\nfailed to load config from /home/projects/bnmijrqrzb.github/vitest.config.ts\n[warn] Overriding NuxtWelcome component. You can specify a `priority` option when calling `addComponent` to avoid this warning.\n[warn] Overriding NuxtLayout component. You can specify a `priority` option when calling `addComponent` to avoid this warning.\n[warn] Overriding NuxtErrorBoundary component. You can specify a `priority` option when calling `addComponent` to avoid this warning.\n[warn] Overriding ClientOnly component. You can specify a `priority` option when calling `addComponent` to avoid this warning.\n[warn] Overriding DevOnly component. You can specify a `priority` option when calling `addComponent` to avoid this warning.\n[warn] Overriding ServerPlaceholder component. You can specify a `priority` option when calling `addComponent` to avoid this warning.\n[warn] Overriding NuxtLink component. You can specify a `priority` option when calling `addComponent` to avoid this warning.\n[warn] Overriding NuxtLoadingIndicator component. You can specify a `priority` option when calling `addComponent` to avoid this warning.\n[warn] Overriding NuxtTime component. You can specify a `priority` option when calling `addComponent` to avoid this warning.\n[warn] Overriding NuxtRouteAnnouncer component. You can specify a `priority` option when calling `addComponent` to avoid this warning.\n[warn] Overriding NuxtImg component. You can specify a `priority` option when calling `addComponent` to avoid this warning.\n[warn] Overriding NuxtPicture component. You can specify a `priority` option when calling `addComponent` to avoid this warning.\n[warn] Overriding NuxtIsland component. You can specify a `priority` option when calling `addComponent` to avoid this warning.\n\n⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Startup Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯\nAggregateError: Failed to initialize projects. There were errors during projects setup. See below for more details.\n at resolveProjects (file:///home/projects/bnmijrqrzb.github/node_modules/vitest/dist/chunks/cli-api.BkDphVBG.js:7515:27)\n at async Vitest._setServer (file:///home/projects/bnmijrqrzb.github/node_modules/vitest/dist/chunks/cli-api.BkDphVBG.js:9348:20)\n at async BasicMinimalPluginContext.handler (file:///home/projects/bnmijrqrzb.github/node_modules/vitest/dist/chunks/cli-api.BkDphVBG.js:10198:6)\n at async _createServer (file:///home/projects/bnmijrqrzb.github/node_modules/vite/dist/node/chunks/dep-BHkUv4Z8.js:28667:86)\n at async createViteServer (file:///home/projects/bnmijrqrzb.github/node_modules/vitest/dist/chunks/cli-api.BkDphVBG.js:6940:17)\n at async createVitest (file:///home/projects/bnmijrqrzb.github/node_modules/vitest/dist/chunks/cli-api.BkDphVBG.js:10231:17)\n at async prepareVitest (file:///home/projects/bnmijrqrzb.github/node_modules/vitest/dist/chunks/cli-api.BkDphVBG.js:10570:14)\n at async startVitest (file:///home/projects/bnmijrqrzb.github/node_modules/vitest/dist/chunks/cli-api.BkDphVBG.js:10517:14)\n at async start (file:///home/projects/bnmijrqrzb.github/node_modules/vitest/dist/chunks/cac.Cb-PYCCB.js:1429:15)\n at async CAC.run (file:///home/projects/bnmijrqrzb.github/node_modules/vitest/dist/chunks/cac.Cb-PYCCB.js:1408:2) {\n [errors]: [\n Error: Nitro is not initialized yet. You can call `useNitro()` only after `ready` hook.\n at Module.useNitro (file:///home/projects/bnmijrqrzb.github/node_modules/@nuxt/kit/dist/index.mjs:890:11)\n at initNuxt (file:///home/projects/bnmijrqrzb.github/node_modules/nuxt/dist/index.mjs:5772:27)\n at async loadNuxt (file:///home/projects/bnmijrqrzb.github/node_modules/nuxt/dist/index.mjs:5864:5)\n at async Module.loadNuxt (file:///home/projects/bnmijrqrzb.github/node_modules/@nuxt/test-utils/node_modules/@nuxt/kit/dist/index.mjs:2822:19)\n at async startNuxtAndGetViteConfig (file:///home/projects/bnmijrqrzb.github/node_modules/@nuxt/test-utils/dist/config.mjs:57:16)\n at async getVitestConfigFromNuxt (file:///home/projects/bnmijrqrzb.github/node_modules/@nuxt/test-utils/dist/config.mjs:111:15)\n at async resolveConfig (file:///home/projects/bnmijrqrzb.github/node_modules/@nuxt/test-utils/dist/config.mjs:297:5)\n at async eval (file:///home/projects/bnmijrqrzb.github/node_modules/@nuxt/test-utils/dist/config.mjs:242:28)\n at async loadConfigFromFile (file:///home/projects/bnmijrqrzb.github/node_modules/vite/dist/node/chunks/dep-BHkUv4Z8.js:36439:20)\n at async resolveConfig (file:///home/projects/bnmijrqrzb.github/node_modules/vite/dist/node/chunks/dep-BHkUv4Z8.js:36093:22)\n ]\n}\n\n\n\nerror Command failed with exit code 1.\ninfo Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\n```\n\n---\n\nDeleting the `vitest.config.ts` file resolves the issue but I want to define a custom config file to add aliases to vitest as well as configure some of the test options\n```ts\nimport path from 'path';\nimport { defineVitestConfig } from '@nuxt/test-utils/config';\n\nexport default defineVitestConfig({\n resolve: {\n alias: {\n '~': path.resolve(__dirname),\n },\n },\n test: {\n environment: 'happy-dom',\n globals: true,\n reporters: 'verbose',\n },\n});\n```\n",[3269],{"name":3173,"color":3174},1375,"Can't define custom vitest.config file anymore since Nuxt 4","2025-08-05T11:21:42Z","https://github.com/nuxt/test-utils/issues/1375",0.663004,["Reactive",3276],{},["Set"],["ShallowReactive",3279],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fNjS79J7QsFl6jsrRHlCOq1GSAddC1VVU5_7rpts9w4A":-1},"/nuxt/test-utils/1419"]