Skip to content

chore: bump nuxt + nuxt/test-utils#1159

Merged
danielroe merged 2 commits intomainfrom
chore/nuxt
Feb 7, 2026
Merged

chore: bump nuxt + nuxt/test-utils#1159
danielroe merged 2 commits intomainfrom
chore/nuxt

Conversation

@danielroe
Copy link
Member

No description provided.

@vercel
Copy link

vercel bot commented Feb 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs.npmx.dev Ready Ready Preview, Comment Feb 7, 2026 8:21pm
npmx.dev Ready Ready Preview, Comment Feb 7, 2026 8:21pm
npmx.dev-vercel Ready Ready Preview, Comment Feb 7, 2026 8:21pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
npmx-lunaria Ignored Ignored Feb 7, 2026 8:21pm

Request Review

@codecov
Copy link

codecov bot commented Feb 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 7, 2026

📝 Walkthrough

Walkthrough

This pull request updates multiple dependencies across the project. The @nuxt/test-utils package is upgraded to version 4.0.0 in both .nuxtrc and package.json (transitioning from a PR reference). The nuxt framework is upgraded to 4.3.1 in both package.json and docs/package.json. The @nuxtjs/i18n plugin is updated to 10.2.3. Additionally, a workaround block in nuxt.config.ts that previously filtered shared-imports.d.ts during type-checking is removed, delegating this responsibility to upstream Nuxt behaviour.

🚥 Pre-merge checks | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request has no description provided by the author, making it impossible to verify that the description relates to the changeset. Add a pull request description that explains the purpose of bumping Nuxt and @nuxt/test-utils versions, and clarify why the workaround in nuxt.config.ts was removed.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/nuxt

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

"@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",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 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:


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:

  1. Vitest v4+ peer dependency: Verify vitest, @vitest/coverage-v8, and other packages are upgraded to v4+ simultaneously (package.json shows only @nuxt/test-utils bumped).
  2. Nuxt composables cannot be top-level in describe blocks: Move any calls to useRouter(), useRoute(), useNuxtApp() etc. from describe-level into beforeAll / beforeEach / test body; they now throw [nuxt] instance unavailable otherwise.
  3. Stricter module mocking: Accessing mocked exports you didn't explicitly return now throws an error instead of returning undefined; use importOriginal to partially mock safely.

Review test files in e2e/ and any other test suites for these patterns before merging.

@danielroe danielroe merged commit 737eb13 into main Feb 7, 2026
22 checks passed
@danielroe danielroe deleted the chore/nuxt branch February 7, 2026 20:25
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.

2 participants