Skip to content

test: add typed route regression coverage#3994

Open
tatakaisun wants to merge 1 commit into
nuxt-modules:mainfrom
tatakaisun:test/3954-typed-route-regression
Open

test: add typed route regression coverage#3994
tatakaisun wants to merge 1 commit into
nuxt-modules:mainfrom
tatakaisun:test/3954-typed-route-regression

Conversation

@tatakaisun

@tatakaisun tatakaisun commented May 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Add regression coverage for typed i18n routes with useRoute().params and RouteLocationRaw props.

Why

Issue #3954 reports typed route regressions after the vue-router v5 update.

Changes

  • Add an issue-specific typedPages + i18n fixture
  • Add type-level assertions for route params and RouteLocationRaw

Testing

  • pnpm dev:prepare
  • pnpm exec vitest run specs/experimental/typed_pages.spec.ts
  • pnpm exec vitest run specs/issues/3954.spec.ts
  • git diff --check

Known Issues

The minimal reproduction passes on current main, so this PR adds coverage only and does not change production types.

Summary by CodeRabbit

  • Tests
    • Added regression test suite for issue #3954 validating TypeScript type diagnostics with internationalization and typed route declarations. The tests ensure route parameters maintain correct type narrowing when using typed pages with localization, and prevent unexpected expansion of route location unions when used in component props.

Review Change Stack

@tatakaisun tatakaisun requested a review from BobbieGoede as a code owner May 21, 2026 12:48
@coderabbitai

coderabbitai Bot commented May 21, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 16031d5e-8f6c-4ebb-b478-15bca9648ad1

📥 Commits

Reviewing files that changed from the base of the PR and between 8cc7ca8 and 1bf99a5.

📒 Files selected for processing (6)
  • specs/fixtures/issues/3954/app.vue
  • specs/fixtures/issues/3954/components/MyLink.vue
  • specs/fixtures/issues/3954/nuxt.config.ts
  • specs/fixtures/issues/3954/pages/index.vue
  • specs/fixtures/issues/3954/pages/widget/[widgetId].vue
  • specs/issues/3954.spec.ts

Walkthrough

This PR adds a regression test fixture for issue #3954, which validates TypeScript type narrowing in Nuxt routes when using the i18n module with typed pages. The fixture includes a Nuxt application configured with i18n (supporting en and fr locales) and typed pages enabled, a reusable MyLink component that accepts RouteLocationRaw, index and dynamic widget pages, and a comprehensive TypeScript diagnostics test that verifies route parameter types remain narrowed and that RouteLocationRaw unions do not expand unexpectedly in i18n route definitions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'test: add typed route regression coverage' accurately reflects the main purpose of the PR, which adds regression test coverage for typed i18n routes with focused test cases validating type diagnostics.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

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.

1 participant