Skip to content

feat(coverage): v8 to support ignoreNode option - #11688

Merged
AriPerkkio merged 6 commits into
vitest-dev:mainfrom
erickserra:feat/coverage-ignore-node
Oct 22, 2026
Merged

AriPerkkio merged 6 commits into
vitest-dev:mainfrom
erickserra:feat/coverage-ignore-node

Conversation

@erickserra

Copy link
Copy Markdown
Contributor

Closes #11663

Adds a coverage.ignoreNode option for the v8 provider, to exclude code from coverage based on its AST node. It's for code that isn't in the source file and so can't carry a /* v8 ignore */ hint, like the cache branches babel-plugin-react-compiler adds to every component.

As discussed in the issue, Vitest's built-in filters run first, so the user's filter only gets nodes Vitest doesn't already ignore.

Tests are in test/coverage-test/test/ignore-node.v8.test.ts: one checks that matching statements and branches are excluded, the other that the filter never gets __vite_ssr_import_* nodes. Both fail without the change in the provider. There's also a type test in configuration-options.test-d.ts.

Adds `coverage.ignoreNode` to exclude code from coverage based on its
AST node, for code that can't carry ignore hints, like code generated
by plugins. Vitest's built-in filters run first.

closes vitest-dev#11663
@netlify

netlify Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 04c50b7
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/6ada017f4a4431494f2495fc
😎 Deploy Preview https://deploy-preview-11688--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment thread docs/config/coverage.md Resolved
Comment thread packages/coverage-v8/src/provider.ts Resolved
Comment thread packages/vitest/package.json Resolved

@AriPerkkio AriPerkkio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me. Thanks! 🙌

@AriPerkkio
AriPerkkio merged commit e02db08 into vitest-dev:main Oct 22, 2026
26 of 29 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(coverage): expose ignoreNode option for the v8 provider

2 participants