chore(deps): update dependency @nuxt/test-utils to v4#59
Open
renovate[bot] wants to merge 1 commit intomainfrom
Open
chore(deps): update dependency @nuxt/test-utils to v4#59renovate[bot] wants to merge 1 commit intomainfrom
renovate[bot] wants to merge 1 commit intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
^3.23.0→^4.0.0Release Notes
nuxt/test-utils (@nuxt/test-utils)
v4.0.0Compare Source
👀 Highlights
We're releasing Nuxt Test Utils v4, with support for Vitest v4. 🚀
Better mocking support
The biggest improvement in this release is how mocking works. Nuxt initialization has been moved from
setupFilesto thebeforeAllhook (#1516), which meansvi.mockandmockNuxtImportcalls now take effect before Nuxt starts. This fixes a long-standing issue where mocks for composables used in middleware or plugins wouldn't apply reliably (#750, #836, #1496).On top of that,
mockNuxtImportnow passes the original implementation to the factory function (#1552), making partial mocking much more natural:registerEndpointimprovementsregisterEndpointnow works correctly with query parameters in URLs (#1560), and endpoints registered in setup files are no longer lost when modules reset (#1549).🚧 Migration
@nuxt/test-utilsv4 contains a few breaking changes, almost all related to requiring at least vitest v4 as a peer dependency (if you are using vitest). It replacesvite-nodewith Vite's native Module Runner and simplifies pool configuration.This will mean improvements for test performance and mocking, but does require some changes to your test code.
Update your dependencies
Update
vitestand its companion packages together:{ "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" } }Peer dependencies
We've tightened peer dependency ranges. You may need to update some of these:
vitest^3.2.0^4.0.2happy-dom*>=20.0.11jsdom*>=27.4.0@jest/globals^29.5.0 || >=30.0.0>=30.0.0@cucumber/cucumber^10.3.1 || >=11.0.0>=11.0.0@testing-library/vue^7.0.0 || ^8.0.1^8.0.1Later environment setup
This is the change that might require most change in your tests. Because we've moved the nuxt environment setup into
beforeAll, this means composables called at the top level of adescribeblock will fail with[nuxt] instance unavailable.This applies to
useRouter(),useNuxtApp(),useRoute(), and any other Nuxt composable or auto-import.Stricter mock exports
If you use
vi.mockwith a factory function, accessing an export that the factory doesn't return will now throw an error instead of silently returningundefined.Other changes
For the full list, see the vitest v4 migration guide.
👉 Changelog
compare changes
🚀 Enhancements
mockNuxtImportfactory (#1552)beforeAllhook (#1516)🩹 Fixes
registerEndpointwith query params (#1560)nextTickimport (#1563)💅 Refactors
@nuxt/devtools-kitfor devtools hooks (426e0b537)📖 Documentation
🏡 Chore
app-vitestfollow advised setup guidelines (#1542).nuxtrc(b4021dee4)✅ Tests
beforeAllhook (#1516)❤️ Contributors
Configuration
📅 Schedule: Branch creation - "on Monday" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.