Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
📝 WalkthroughWalkthroughThis pull request updates multiple dependencies across the project. The 🚥 Pre-merge checks | ❌ 1❌ Failed checks (1 warning)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
| "@nuxt/fonts": "0.13.0", | ||
| "@nuxt/scripts": "0.13.2", | ||
| "@nuxt/test-utils": "https://pkg.pr.new/@nuxt/test-utils@1499a48", | ||
| "@nuxt/test-utils": "4.0.0", |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
@nuxt/test-utils 4.0.0 breaking changes migration guide
💡 Result:
@nuxt/test-utils v4.0.0 migration / breaking changes
Primary source: the v4.0.0 release notes include a “Migration” section with the breaking changes and examples. [1]
1) Upgrade required deps (Vitest v4+)
Update Vitest and companion packages together (and ensure your peer deps satisfy the new minimums): [1]
{
"devDependencies": {
- "@nuxt/test-utils": "^3.x",
- "vitest": "^3.x",
- "@vitest/coverage-v8": "^3.x"
+ "@nuxt/test-utils": "^4.0",
+ "vitest": "^4.0",
+ "@vitest/coverage-v8": "^4.0"
}
}Also note tightened peer ranges (examples from release notes): vitest ^4.0.2, happy-dom >=20.0.11, jsdom >=27.4.0, etc. [1]
2) Nuxt runtime now initializes later (moved to beforeAll)
Nuxt env setup moved from setupFiles to a beforeAll hook. Result: don’t call Nuxt composables at the top level of a describe block (you’ll get [nuxt] instance unavailable). Move them into beforeAll / beforeEach / the test body. [1]
describe('my test', () => {
- const router = useRouter()
+ let router: ReturnType<typeof useRouter>
+ beforeAll(() => {
+ router = useRouter()
+ })
})Applies to useRouter(), useNuxtApp(), useRoute(), and other Nuxt auto-imports/composables. [1]
3) Stricter module mocking behavior
If you use vi.mock with a factory, accessing an export you didn’t return now throws (instead of returning undefined). Use importOriginal to partially mock safely. [1]
vi.mock('./module', async (importOriginal) => ({
...await importOriginal(),
foo: 'mocked',
}))For additional Vitest v4 mocking changes, follow Vitest’s v4 migration guide. [2]
4) Other notable internals
v4 “replaces vite-node with Vite’s native Module Runner” and “simplifies pool configuration” (mentioned as part of the v4 migration notes). [1]
References:
[1] @nuxt/test-utils v4.0.0 release notes (migration + breaking changes) (github.com)
[2] Vitest migration guide (v4) (vitest.dev)
Citations:
- 1: https://github.com/nuxt/test-utils/releases
- 2: https://vitest.dev/guide/migration?utm_source=openai
Ensure Vitest is upgraded to v4+ and test files comply with @nuxt/test-utils 4.0.0 breaking changes.
This major version bump introduces several breaking changes requiring test file updates:
- Vitest v4+ peer dependency: Verify
vitest,@vitest/coverage-v8, and other packages are upgraded to v4+ simultaneously (package.json shows only@nuxt/test-utilsbumped). - Nuxt composables cannot be top-level in describe blocks: Move any calls to
useRouter(),useRoute(),useNuxtApp()etc. from describe-level intobeforeAll/beforeEach/ test body; they now throw[nuxt] instance unavailableotherwise. - Stricter module mocking: Accessing mocked exports you didn't explicitly return now throws an error instead of returning
undefined; useimportOriginalto partially mock safely.
Review test files in e2e/ and any other test suites for these patterns before merging.
No description provided.