\n\u003C!-- OR -->\n\u003CIcon name=\"my-icon:a\" v-if=\"flag\" />\n\u003CIcon name=\"my-icon:b\" v-else />\n```\nin `nuxt.config.ts`\n```ts\nicon: {\n provider: 'server',\n customCollections: [\n {\n prefix: 'my-icon',\n dir: './assets/icon/svg',\n },\n ],\n},\n// ...\nnitro: {\n preset: 'static',\n},\n```\n\nIf toggle value of `flag`, \neverything works well in development, \nbut it throws 404 error for `my-icon:b` after building and generating.\n(it works well with `v-show`) \n\nProject info:\n```\n------------------------------\n- Operating System: Windows_NT\n- Node Version: v22.8.0\n- Nuxt Version: 3.16.0\n- CLI Version: 3.23.0\n- Nitro Version: 2.11.6\n- Package Manager: pnpm@9.9.0\n- Builder: -\n- User Config: modules, icon, colorMode, shadcn, fonts, googleSignIn, app, imports, css, vite, nitro, compatibilityDate, telemetry\n- Runtime Modules: @nuxtjs/tailwindcss@6.13.2, @nuxt/icon@1.11.0, @nuxt/fonts@0.11.0, @nuxt/image@1.9.0, @nuxt/eslint@1.2.0, @pinia/nuxt@0.10.1, pinia-plugin-persistedstate/nuxt@4.2.0, @nuxt/test-utils/module@3.17.2, @nuxtjs/color-mode@3.5.2, shadcn-nuxt@1.0.3, @vueuse/nuxt@13.0.0, nuxt-vue3-google-signin@0.0.11\n- Build Modules: -\n------------------------------\n```\n",[],380,"nuxt","icon","open","Local icon 404 after `nuxi generating` if with `:name=\"flag?'my-icon:icon-a':'my-icon:icon-b'\"`","2025-03-26T15:31:52Z","https://github.com/nuxt/icon/issues/380",0.677091,{"labels":1993,"number":1994,"owner":1985,"repository":1985,"state":1995,"title":1996,"updated_at":1997,"url":1998,"score":1999},[],14414,"closed","Following the Nuxt 3 guide to testing leads you to problems","2023-01-19T17:35:07Z","https://github.com/nuxt/nuxt/issues/14414",0.6524917,{"labels":2001,"number":2008,"owner":1985,"repository":1985,"state":1995,"title":2009,"updated_at":2010,"url":2011,"score":2012},[2002,2005],{"name":2003,"color":2004},"pending triage","E99695",{"name":2006,"color":2007},"2.x","d4c5f9",6852,"Compatibility issue with Nuxt@2.11 and @vue/test-utils","2023-01-22T15:34:48Z","https://github.com/nuxt/nuxt/issues/6852",0.65290475,{"description":2014,"labels":2015,"number":2023,"owner":1985,"repository":1985,"state":1995,"title":2024,"updated_at":2025,"url":2026,"score":2027},"### 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",[2016,2019,2020],{"name":2017,"color":2018},"3.x","29bc7f",{"name":2003,"color":2004},{"name":2021,"color":2022},"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.65443295,{"description":2029,"labels":2030,"number":2033,"owner":1985,"repository":1985,"state":1995,"title":2034,"updated_at":2035,"url":2036,"score":2037},"### Version\n\n[v2.3.4](https://github.com/nuxt.js/releases/tag/v2.3.4)\n\n### Reproduction link\n\n[https://nuxtjs.org/](https://nuxtjs.org/)\n\n### Steps to reproduce\n\nRun: `yarn create nuxt-app project`\nChoose Linter and JestJs and SPA mode.\n\nWithout adding any additional content, run `yarn test`\n\n### What is expected ?\n\nI expect the default test to pass.\n\n### What is actually happening?\n\nI receive this error message:\n\n```\nyarn run v1.13.0\n$ jest\n FAIL test/Logo.spec.js\n ● Test suite failed to run\n\n Jest encountered an unexpected token\n\n This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.\n\n By default, if Jest sees a Babel config, it will use that to transform your files, ignoring \"node_modules\".\n\n Here's what you can do:\n • To have some of your \"node_modules\" files transformed, you can specify a custom \"transformIgnorePatterns\" in your config.\n • If you need a custom transformation specify a \"transform\" option in your config.\n • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the \"moduleNameMapper\" config option.\n\n You'll find more details and examples of these config options in the docs:\n https://jestjs.io/docs/en/configuration.html\n\n Details:\n\n /home/begueradj/Development/project/test/Logo.spec.js:1\n ({\"Object.\u003Canonymous>\":function(module,exports,require,__dirname,__filename,global,jest){import { mount } from '@vue/test-utils';\n ^\n\n SyntaxError: Unexpected token {\n\n at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/script_transformer.js:403:17)\n\nTest Suites: 1 failed, 1 total\nTests: 0 total\nSnapshots: 0 total\nTime: 0.803s\nRan all test suites.\nerror Command failed with exit code 1.\ninfo Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\n```\n\n### Note\nThis occurs **only** when I move the content of project to an other folder where of course I remove `node_modes` and `.nuxt` folders.\n\nI **need** to copy the content of the generate folder to an other place because I am working with Git branches\n\n\n\n\u003C!--cmty-->\n\u003Cdiv align=\"right\">\u003Csub>\u003Cem>This bug report is available on \u003Ca href=\"https://cmty.app/nuxt\">Nuxt\u003C/a> community (\u003Ca href=\"https://cmty.app/nuxt/nuxt.js/issues/c8573\">#c8573\u003C/a>)\u003C/em>\u003C/sub>\u003C/div>",[2031,2032],{"name":2003,"color":2004},{"name":2006,"color":2007},4899,"Default test does not pass","2023-01-22T15:30:09Z","https://github.com/nuxt/nuxt/issues/4899",0.65626776,{"description":2039,"labels":2040,"number":2043,"owner":1985,"repository":1985,"state":1995,"title":2044,"updated_at":2045,"url":2046,"score":2047},"### 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",[2041,2042],{"name":2017,"color":2018},{"name":2003,"color":2004},15315,"Issues running Vitest within Nuxt3","2023-01-30T12:17:13Z","https://github.com/nuxt/nuxt/issues/15315",0.66414523,{"description":2049,"labels":2050,"number":2055,"owner":1985,"repository":1985,"state":1995,"title":2056,"updated_at":2057,"url":2058,"score":2059},"I believe that since v1.x nuxt now returns a promise, would this then be an acceptable way to run tests against it? And if not how? and should/can we update the documentation?\r\n\r\n```javascript\r\n\r\n\r\nimport test from 'ava'\r\nimport Nuxt from 'nuxt'\r\nimport { resolve } from 'path'\r\n\r\nlet nuxt = null\r\nlet server = null\r\n\r\nconst rootDir = resolve(__dirname, '..')\r\nlet config = {}\r\ntry { config = require(resolve(rootDir, 'nuxt.config.js')) } catch (e) {}\r\nconfig.rootDir = rootDir // project folder\r\nconfig.dev = false // production build\r\n\r\nnuxt = new Nuxt(config).then(nuxt => {\r\n\r\n test.before('Initializing Nuxt.js', async t => {\r\n await nuxt.build()\r\n server = new nuxt.Server(nuxt)\r\n server.listen(4000, 'localhost')\r\n })\r\n\r\n test('Route / exits and renders HTML', async t => {\r\n let context = {}\r\n const { html } = await nuxt.renderRoute('/', context)\r\n t.true(html.includes('\u003Cdiv class=\"page home\">'))\r\n })\r\n\r\n test.after('Closing the server and nuxt.js', t => {\r\n server.close()\r\n nuxt.close()\r\n })\r\n\r\n})\r\n\r\n```\n\n\u003C!--cmty-->\u003C!--cmty_prevent_hook-->\n\u003Cdiv align=\"right\">\u003Csub>\u003Cem>This question is available on \u003Ca href=\"https://nuxtjs.cmty.io\">Nuxt.js\u003C/a> community (\u003Ca href=\"https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c855\">#c855\u003C/a>)\u003C/em>\u003C/sub>\u003C/div>",[2051,2054],{"name":2052,"color":2053},"question","cc317c",{"name":2006,"color":2007},987,"unit testing with v1.x","2023-01-18T15:40:37Z","https://github.com/nuxt/nuxt/issues/987",0.66424567,{"description":2061,"labels":2062,"number":2063,"owner":1985,"repository":2064,"state":1995,"title":2065,"updated_at":2066,"url":2067,"score":2068},"Hi,\r\n\r\nI was trying to integrate @nuxt/test-utils in my Nuxt application in order to test pages.\r\nI already have a bunch of tests written for the components that use @vue/test-utils.\r\n\r\nAfter following the documentation and adding the `@nuxt/test-utils` preset to my jest configuration, all my components tests started failing with the same error:\r\n\r\n```shell\r\n[vue-test-utils]: window is undefined, vue-test-utils needs to be run in a browser environment. \r\n You can run the tests in node using jsdom \r\n See https://vue-test-utils.vuejs.org/guides/#browser-environment for more details.\r\n```\r\n\r\nAny idea how to solve this and be able to use both tools within the same project ?\r\n\r\nThanks!",[],327,"test-utils","Conflict between @nuxt/test-utils jest preset and @vue/test-utils","2023-12-02T00:23:10Z","https://github.com/nuxt/test-utils/issues/327",0.66554254,{"description":2070,"labels":2071,"number":2072,"owner":1985,"repository":2064,"state":1995,"title":2073,"updated_at":2074,"url":2075,"score":2076},"Trying to get the test-utils to work, but after adding the preset, JEST simply won't run, saying that the test utils cannot be found.\r\n\r\nThis is straight from the docs. I've tried a bunch of different versions, and simply cannot get them to work. This is required (I think) in order to get the global function calls (such as definePageMeta) to work in tests.\r\n\r\n> ● Validation Error:\r\n>\r\n> Preset @nuxt/test-utils not found.\r\n>\r\n> Configuration Documentation:\r\n> https://jestjs.io/docs/configuration.html\r\n\r\nThe test utils are installed.\r\n\r\nAny ideas?",[],280,"Preset @nuxt/test-utils not found.","2023-12-02T00:18:11Z","https://github.com/nuxt/test-utils/issues/280",0.66711366,{"description":2078,"labels":2079,"number":2084,"owner":1985,"repository":1985,"state":1995,"title":2085,"updated_at":2086,"url":2087,"score":2088},"Hi @Atinux and @eddyerburgh,\r\n\r\nThis is the first attempt to integrate Jest with Nuxt.js . I ran into couple of error related to `nuxt` library which I don't understand. It would be nice to have a look at the sample codebase here https://github.com/piyushchauhan2011/nuxt-with-jest .\r\n\r\nPros:\r\n\r\n- Was able to test store and sample `.js` files\r\n- I was also able to unit-test components\r\n- Snapshot testing\r\n\r\n\r\n\r\nBroken:\r\n\r\n- End to end testing\r\n\r\n```\r\n ERROR in ./.nuxt/client.js\r\n Module build failed: Error: Cannot find module '../../package' from 'node.js'\r\n at Resolver.resolveModule (/Users/piyushchauhan/Documents/jirnexu/nuxt-with-jest/node_modules/jest-resolve/build/index.js:179:17)\r\n at Resolver._getVirtualMockPath (/Users/piyushchauhan/Documents/jirnexu/nuxt-with-jest/node_modules/jest-resolve/build/index.js:296:23)\r\n at Resolver._getAbsolutPath (/Users/piyushchauhan/Documents/jirnexu/nuxt-with-jest/node_modules/jest-resolve/build/index.js:279:10)\r\n at Resolver.getModuleID (/Users/piyushchauhan/Documents/jirnexu/nuxt-with-jest/node_modules/jest-resolve/build/index.js:252:31)\r\n at Runtime._shouldMock (/Users/piyushchauhan/Documents/jirnexu/nuxt-with-jest/node_modules/jest-runtime/build/index.js:574:37)\r\n at Runtime.requireModuleOrMock (/Users/piyushchauhan/Documents/jirnexu/nuxt-with-jest/node_modules/jest-runtime/build/index.js:402:14)\r\n```\n\n\u003C!--cmty-->\u003C!--cmty_prevent_hook-->\n\u003Cdiv align=\"right\">\u003Csub>\u003Cem>This feature request is available on \u003Ca href=\"https://nuxtjs.cmty.io\">Nuxt.js\u003C/a> community (\u003Ca href=\"https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c936\">#c936\u003C/a>)\u003C/em>\u003C/sub>\u003C/div>",[2080,2083],{"name":2081,"color":2082},"enhancement","8DEF37",{"name":2006,"color":2007},1075,"Attempting to integrate Jest with Nuxt.js","2023-01-18T15:40:44Z","https://github.com/nuxt/nuxt/issues/1075",0.66736627,["Reactive",2090],{},["Set"],["ShallowReactive",2093],{"TRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"zumVfXZvYtNbTZOyGrNjjXIRDWAkGgeJAL9E4aLKw7A":-1},"/nuxt/test-utils/347"]