-
Notifications
You must be signed in to change notification settings - Fork 97
Open
Labels
Description
Environment
- Operating System: Linux
- Node Version: v20.16.0
- Nuxt Version: 3.17.2
- CLI Version: 3.25.0
- Nitro Version: 2.11.11
- Package Manager: npm@10.8.1
- Builder: -
- User Config: modules, devtools, compatibilityDate
- Runtime Modules: @nuxt/test-utils/module@3.18.0
- Build Modules: -
Reproduction
Github repo: https://github.com/wuiyang/nuxt-layer-test-bug
Stackblitz: https://stackblitz.com/~/github.com/wuiyang/nuxt-layer-test-bug
Describe the bug
When project root is using Nuxt 4 version (via config future.compatibilityVersion = 4
), nuxt test utils would not work on layers within same project.
The unit test would run without console error log, but the test report would show there is an error:
TypeError: Cannot read properties of undefined (reading 'vueApp')
When project root is not using Nuxt 4 version, the nuxt test utils would work as expected.
See reproduction repo:
- Github: https://github.com/wuiyang/nuxt-layer-test-bug/tree/working-without-nuxt-4
- Stackblitz: https://stackblitz.com/~/github.com/wuiyang/nuxt-layer-test-bug/tree/working-without-nuxt-4?file=package.json
Additional context
No response
Logs
abc@efac4cbfa0a5:/..../nuxt-layer-test-bug$ npx vitest run --coverage
Vitest "environmentMatchGlobs" is deprecated. Use "workspace" to define different configurations instead.
HTML Report is generated
You can run npx vite preview --outDir ../test-reports/unit-test to see the test results.