Skip to content

chore(deps): update devdependency @nuxt/test-utils to v4 - #137

Open
renovate[bot] wants to merge 1 commit into
mainfrom
renovate/nuxt-test-utils-4.x
Open

chore(deps): update devdependency @nuxt/test-utils to v4#137
renovate[bot] wants to merge 1 commit into
mainfrom
renovate/nuxt-test-utils-4.x

Conversation

@renovate

@renovate renovate Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Change Age Confidence
@nuxt/test-utils ^3.17.0^4.3.2 age confidence

Release Notes

nuxt/test-utils (@​nuxt/test-utils)

v4.3.2

Compare Source

v4.3.2 is the next patch release.

👉 Changelog

compare changes

🩹 Fixes
  • vitest-environment: keep vitest/environments import opaque to rolldown (6d1195d38)
❤️ Contributors

v4.3.1

Compare Source

v4.3.1 is the next patch release.

👉 Changelog

compare changes

🩹 Fixes
  • deps: allow vitest ^5 as peer dependency (#​1809)
🏡 Chore
🎉 New Contributors
❤️ Contributors

v4.3.0

Compare Source

v4.2.1 is the next minor release.

👉 Changelog

compare changes

🚀 Enhancements
  • runtime-utils: add unmockNuxtImport helper (#​1795)
  • config: support vitest 5 (#​1802)
🩹 Fixes
  • config: default nuxt test pattern to nested for simple non-nuxt setup (#​1801)
✅ Tests
  • make sure tests are collected at runtime, not statically (#​1797)
🎉 New Contributors
❤️ Contributors

v4.2.0

Compare Source

v4.2.0 is the next minor release.

👉 Changelog

compare changes

🚀 Enhancements
  • browser: add render helper for vitest browser mode (#​1725)
  • runtime-utils: add spy option to mount + render helpers (#​1762)
🩹 Fixes
  • runtime-utils: mockNuxtImport sourcemap mapped position (#​1787)
  • config: tolerate non-cloneable values when cloning config (#​1771)
  • e2e: honour setupTimeout in playwright + surface server logs (#​1785)
  • e2e: add explanation if server exited before being ready (#​1761)
  • module: handle string presets in auto-imports (#​1784)
  • config: don't run includeSource in both projects in defineVitestConfig (#​1763)
  • e2e: use taskkill to kill processes on windows (#​1760)
  • config: support nuxt v5 with nitro vite environment (#​1758)
🏡 Chore
  • avoid missing file extension warning in test/examples (#​1775)
  • exempt first-party packages from pnpm minimumReleaseAge (#​1774)
  • replace latest ranges with caret ranges (#​1773)
  • move vite environment api tests to example tests (#​1755)
✅ Tests
  • re-enable bun browser e2e on windows (#​1791)
🤖 CI
  • migrate to uppt for release workflow (#​1792)
🎉 New Contributors
❤️ Contributors

v4.1.0

Compare Source

4.1.0 is the next minor release.

👉 Changelog

compare changes

🚀 Enhancements
  • e2e: Silence server logs and allow customising log level (#​1735)
  • runtime: Improve app.root and app.teleports html tag setup (#​1726)
🩹 Fixes
  • e2e: Add warning message for e2e in nuxt vitest setup (#​1691)
  • runtime-utils: Ensure RouterLink stub works with pages: false (#​1687)
  • config: Patch ssr.resolve.conditions to remove import (#​1732)
  • config: Browser setup in defineVitestProject (#​1724)
  • config: Inline config for useRuntimeConfig() composable (#​1737)
  • config: Nested browser-mode Nuxt Vitest projects with viteEnvironmentApi (#​1708)
📦 Build
🏡 Chore
  • Drop pkg.pr.new nitro resolution (#​1681)
  • Migrate to pnpm v11 (#​1701)
  • Move h3-next to optional dependencies (#​1733)
✅ Tests
  • Add test for autoImport: false (#​1688)
🤖 CI
  • Add agent-scan workflow to flag bot-authored PRs (13dd49cde)
  • Migrate agentscan-action to v2 (08f8ee220)
❤️ Contributors

v4.0.3

Compare Source

4.0.3 is the next patch release.

👉 Changelog

compare changes

🩹 Fixes
  • runtime-utils: Lazily import root-component in mount + render helpers (#​1665)
  • runtime-utils: Insert compilerOptions conditionally (#​1659)
  • config: Enable sourcemaps when vitest coverage is enabled (#​1674)
  • module: Exclude test files from Nuxt plugin registration (#​1666)
  • runtime-utils: Provide NuxtLink isActive slot props (#​1640)
  • e2e: Wait for HTTP readiness before resolving startServer (#​1675)
🏡 Chore
❤️ Contributors

v4.0.2

Compare Source

👉 Changelog

compare changes

🩹 Fixes
  • config: Respect override dev value (#​1602)
🤖 CI
  • Use pnpm publish to resolve workspace dependencies (#​1651)
❤️ Contributors

v4.0.1

Compare Source

👉 Changelog

compare changes

🩹 Fixes
  • config: Rename deps.optimizer.web to client for vitest4 (#​1593)
  • runtime-utils: Fix mockNuxtImport types when using string target (#​1592)
  • config: Pass non-project options for non-nuxt simple setup (#​1582)
  • config: Do not import defineConfig from vite (1aa5e8748)
  • runtime: Handle ResourceLoader removal in jsdom v28 (#​1611)
  • config,vitest-environment: Directly import peerDeps (#​1617)
  • runtime-utils: Align mount options merge w/ vue-test-utils (#​1610)
  • vitest-environment: Avoid vitest/environments import warning (#​1627)
  • runtime: Avoid error when vue/test-utils is not installed (#​1646)
  • config: Prefer project h3 version if present (#​1641)
🏡 Chore
  • Bump vitest-environment-nuxt versions (f5ec72127)
  • Use workspace dependency (14fb254a7)
  • Example playwright config improve type annotation for devices (#​1581)
  • pkg-pr-new prerelease vitest-environment-nuxt (#​1601)
  • Allow explicit any (633c93c2a)
  • Switch unit test target to dir and move type unit tests to test:types (#​1618)
  • Update lockfile (8306abf00)
✅ Tests
  • Add failing test for stubbed global provide (#​1314)
  • Update assertions deprecated in vitest 4.1 (#​1629)
  • Change example/workspace to use glob based projects setup (#​1585)
🤖 CI
  • Pin github actions to full-length commit shas (2832fd6d5)
  • Avoid checkout for reproduction comment (e4e67ab09)
  • Rename workflow (99318b9fc)
  • Correctly publish pkg-pr-new prerelease (#​1598)
❤️ Contributors

v4.0.0

Compare Source

4.0.0 is the next major release.

👀 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 setupFiles to the beforeAll hook (#​1516), which means vi.mock and mockNuxtImport calls 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, mockNuxtImport now passes the original implementation to the factory function (#​1552), making partial mocking much more natural:

mockNuxtImport('useRoute', original => vi.fn(original))

it('my test', async () => {
  vi.mocked(useRoute).mockImplementation(
    (...args) => ({ ...vi.mocked(useRoute).getMockImplementation()!(...args), path: '/mocked' }),
  )

  const wrapper = await mountSuspended(MyComponent)
  expect(wrapper.find('#path').text()).toBe('/mocked')
})
registerEndpoint improvements

registerEndpoint now 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-utils v4 contains a few breaking changes, almost all related to requiring at least vitest v4 as a peer dependency (if you are using vitest). It replaces vite-node with 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.

[!TIP]
Most of the changes below are straightforward. The biggest thing to watch out for is code that runs at the top level of a describe block — see below.

Update your dependencies

Update vitest and 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:

Dependency v3 v4
vitest ^3.2.0 ^4.0.2
happy-dom * >=20.0.11
jsdom * >=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.1
Later 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 a describe block will fail with [nuxt] instance unavailable.

// Before (worked in vitest v3)
describe('my test', () => {
  const router = useRouter() // ran lazily, after environment setup
  // ...
})

// After (vitest v4)
describe('my test', () => {
  let router: ReturnType<typeof useRouter>

  beforeAll(() => {
    router = useRouter() // runs after environment setup
  })
  // ...
})

This applies to useRouter(), useNuxtApp(), useRoute(), and any other Nuxt composable or auto-import.

[!TIP]
If you only need the value within individual tests, beforeEach or directly within the test works too.

Stricter mock exports

If you use vi.mock with a factory function, accessing an export that the factory doesn't return will now throw an error instead of silently returning undefined.

// Before: accessing `bar` would silently return undefined
vi.mock('./module', () => ({ foo: 'mocked' }))

// After: accessing `bar` throws
// Fix: use importOriginal to include all exports
vi.mock('./module', async (importOriginal) => ({
  ...await importOriginal(),
  foo: 'mocked',
}))

[!NOTE]
If you're mocking a virtual module (like #build/nuxt.config.mjs) where importOriginal can't resolve the real module, you might need to explicitly list all accessed exports in your mock factory.

Other changes

For the full list, see the vitest v4 migration guide.

👉 Changelog

compare changes

🚀 Enhancements
  • deps: ⚠️ Upgrade to vitest v4 (#​1481)
  • deps: ⚠️ Drop official support for older versions of test runners + dom environments (31fdc262a)
  • runtime-utils: Pass original to mockNuxtImport factory (#​1552)
  • runtime: ⚠️ Change nuxt start timing to beforeAll hook (#​1516)
  • e2e: Support setup and teardown timeouts in setupBun (#​1578)
🩹 Fixes
  • runtime: Handle optional chaining vueWrapper plugin installed check (#​1547)
  • runtime-utils: Keep endpoints from registerEndpoint in setup file (#​1549)
  • runtime-utils: Support registerEndpoint with query params (#​1560)
  • runtime-utils: Avoid local variable in mockNuxtImport macro (#​1564)
  • runtime-utils: Add missing nextTick import (#​1563)
  • Pin h3-next to patch (1ff3bbb91)
  • playwright: Bump windows timeout (63e39b7c9)
  • config: Respect include options in non nuxt environment simple setup (#​1570)
💅 Refactors
  • module: Use @nuxt/devtools-kit for devtools hooks (426e0b537)
  • runtime: Remove unnecessary querySelector (#​1577)
📖 Documentation
🏡 Chore
  • Allow changelog update util to return major bump (9e86cadab)
  • Make app-vitest follow advised setup guidelines (#​1542)
  • Update lockfile (6d798b5e1)
  • config: Migrate Renovate config (#​1568)
  • Add test utils setup to .nuxtrc (b4021dee4)
✅ Tests
  • Avoid running root test script twice (44f6bd396)
⚠️ Breaking Changes
  • deps: ⚠️ Upgrade to vitest v4 (#​1481)
  • deps: ⚠️ Drop official support for older versions of test runners + dom environments (31fdc262a)
  • runtime: ⚠️ Change nuxt start timing to beforeAll hook (#​1516)
❤️ Contributors

Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • 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.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate
renovate Bot force-pushed the renovate/nuxt-test-utils-4.x branch 3 times, most recently from 5b38d31 to 574d6da Compare July 31, 2026 06:06
@renovate
renovate Bot force-pushed the renovate/nuxt-test-utils-4.x branch from 574d6da to 50ec2d3 Compare August 11, 2026 23:33
@renovate
renovate Bot force-pushed the renovate/nuxt-test-utils-4.x branch from 50ec2d3 to 1454584 Compare August 13, 2026 05:41
@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown

Preview site

pr-137: https://pr-137--stuartclark.netlify.app

Updated 2026-09-09T10:01:51Z

@renovate
renovate Bot force-pushed the renovate/nuxt-test-utils-4.x branch from 1454584 to b6fd16f Compare August 14, 2026 20:32
@renovate
renovate Bot force-pushed the renovate/nuxt-test-utils-4.x branch 2 times, most recently from dc0824e to 07d435c Compare August 27, 2026 20:55
@renovate
renovate Bot force-pushed the renovate/nuxt-test-utils-4.x branch 3 times, most recently from bd8982a to 9c915bc Compare September 7, 2026 23:32
@renovate
renovate Bot force-pushed the renovate/nuxt-test-utils-4.x branch from 9c915bc to e759c87 Compare September 9, 2026 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants