You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(using stackblitz's template for github/nuxt/test-utils/tree/main/examples/app-vitest, but I removed all non-necessary tests)
Describe the bug
We are moving a project from Vue to Nuxt and we are using future: { multiApp: true } as part of this project's solution. When moving tests, we noticed they don't work and are throwing errors that other projects weren't. Upon further investigation, we pinpointed to the multiApp flag.
Running tests (npm run test) with future: { multiApp: false } passes tests. When changing to future: { multiApp: true }, we got the following errors:
During vitest running the file:
stderr | test/app.nuxt.spec.ts
[nuxt] error caught during app initialization TypeError: Cannot read properties of undefined (reading 'app')
at setup (/home/projects/jvmikwmyxv.github/node_modules/nuxt/dist/app/plugins/router.js:48:139)
at eval (/home/projects/jvmikwmyxv.github/node_modules/nuxt/dist/app/nuxt.js:156:60)
at fn (/home/projects/jvmikwmyxv.github/node_modules/nuxt/dist/app/nuxt.js:238:44)
at Object.runWithContext (/home/projects/jvmikwmyxv.github/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:4218:18)
at callWithNuxt (/home/projects/jvmikwmyxv.github/node_modules/nuxt/dist/app/nuxt.js:244:24)
at eval (/home/projects/jvmikwmyxv.github/node_modules/nuxt/dist/app/nuxt.js:55:41)
at EffectScope.run (/home/projects/jvmikwmyxv.github/node_modules/@vue/reactivity/dist/reactivity.cjs.js:85:16)
at Object.runWithContext (/home/projects/jvmikwmyxv.github/node_modules/nuxt/dist/app/nuxt.js:55:31)
at applyPlugin (/home/projects/jvmikwmyxv.github/node_modules/nuxt/dist/app/nuxt.js:156:39)
at executePlugin (/home/projects/jvmikwmyxv.github/node_modules/nuxt/dist/app/nuxt.js:175:23)
which is referencing to NuxtPlugin nuxt:router's setup where useRuntimeConfig is not returning an app in useRuntimeConfig().app.baseURL
and Vitest report after finished running shows the following:
There seems to be some kind of issue in Router when multiApp is preset. We do have appId and app.rootId set in nuxt.config, but this made no change to the tests so I did not include in the stackblitz.
If multiApp is fighting a single implicit Nuxt root, a recipe-based harness can help: each app is an explicit recipe { id, root, … } with its own prepare identity, instead of one global setup assuming one app.
That is how untestutils models targets (clean break, not API-compatible). We dogfood it on a multi-fixture Nuxt module suite — e.g. 265 e2e ~4 min shared prepare:
Activity
s00d commentedon Sep 21, 2026
If
multiAppis fighting a single implicit Nuxt root, a recipe-based harness can help: each app is an explicit recipe{ id, root, … }with its own prepare identity, instead of one global setup assuming one app.That is how untestutils models targets (clean break, not API-compatible). We dogfood it on a multi-fixture Nuxt module suite — e.g. 265 e2e ~4 min shared prepare:
https://github.com/s00d/nuxt-i18n-micro/actions/runs/35586385667/job/106290602444
https://s00d.github.io/untestutils/