fix(config): enable sourcemaps when vitest coverage is enabled by danielroe · Pull Request #1674 · nuxt/test-utils · GitHub
Skip to content

fix(config): enable sourcemaps when vitest coverage is enabled#1674

Merged
danielroe merged 1 commit into
mainfrom
fix/coverage
Apr 24, 2026
Merged

fix(config): enable sourcemaps when vitest coverage is enabled#1674
danielroe merged 1 commit into
mainfrom
fix/coverage

Conversation

@danielroe

Copy link
Copy Markdown
Member

🔗 Linked issue

resolves #1655

📚 Description

this enables client-side sourcemaps when coverage is enabled in vitest

@danielroe danielroe requested a review from yamachi4416 April 24, 2026 11:20
@pkg-pr-new

pkg-pr-new Bot commented Apr 24, 2026

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Apr 24, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 19f7ce5d-5cda-42e0-b848-ee300ed1eeab

📥 Commits

Reviewing files that changed from the base of the PR and between 0c1d37d and 3fa1012.

📒 Files selected for processing (1)
  • src/config.ts

📝 Walkthrough

Walkthrough

Adds an internal helper isCoverageEnabled that determines coverage enablement by checking both Nuxt config (test.coverage.enabled) and Vitest CLI args. In resolveConfig, when coverage is detected, the code ensures client-side sourcemaps are enabled by updating test.environmentOptions.nuxt.overrides to set overrides.sourcemap.client = true, creating the sourcemap object if absent and adding the client field if missing. No exported/public signatures are changed.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and accurately summarizes the main change: enabling sourcemaps when vitest coverage is enabled.
Description check ✅ Passed The description is related to the changeset, referencing the linked issue #1655 and explaining that client-side sourcemaps are enabled when coverage is on.
Linked Issues check ✅ Passed The PR addresses issue #1655 by enabling client-side sourcemaps when coverage is enabled, which directly targets the source map drift problem causing phantom branch coverage.
Out of Scope Changes check ✅ Passed All changes in the PR are in-scope: the new isCoverageEnabled helper and sourcemap configuration modifications directly target the issue's root cause of source map position drift.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/coverage

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.

@danielroe

Copy link
Copy Markdown
Member Author

@antoinezanardi does this resolve things for you? 🙏

@antoinezanardi

Copy link
Copy Markdown

@danielroe danielroe merged commit d318d64 into main Apr 24, 2026
10 checks passed
@danielroe danielroe deleted the fix/coverage branch April 24, 2026 15:40
@github-actions github-actions Bot mentioned this pull request Apr 23, 2026
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.

V8 coverage reports phantom branch (50%) due to source map drift when @nuxt/ui is loaded

3 participants