Skip to content

feat: implement V8 coverage provider#1117

Merged
9aoy merged 62 commits into
web-infra-dev:mainfrom
colinaaa:feature/v8-coverage-improvements
May 21, 2026
Merged

feat: implement V8 coverage provider#1117
9aoy merged 62 commits into
web-infra-dev:mainfrom
colinaaa:feature/v8-coverage-improvements

Conversation

@colinaaa

@colinaaa colinaaa commented Mar 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR introduces a brand-new @rstest/coverage-v8 package which provides precise, high-performance V8-based coverage collection for Rstest as an alternative to the existing Istanbul coverage provider.

Key Changes

  • Core Integration:
    • Updated the CoverageProvider interface to support asynchronous init and collect methods
    • Added safe teardown and error handling logic within the worker pool to ensure node:inspector sessions don't leak during test crashes
  • V8 Provider implementation:
    • Implements coverage collection using node:inspector to profile code execution and v8-to-istanbul to transform node-native profiles into Istanbul-compatible metrics
    • Fully supports coverage.include and coverage.exclude configurations using picomatch directly on V8 profiles
    • Filters out virtual/runtime framework code generated in-memory during testing
    • Concurrent and non-blocking architecture when loading source map/file assets for high performance mapping

Related

Follows the previously discussed design plan and implementation plan.

colinaaa added 11 commits March 29, 2026 15:56
…t runtime files

This commit improves the coverage-v8 implementation to properly support Rsbuild's in-memory execution environment.

- Updates the `CoverageProvider.collect` API to accept `assetFiles` and `sourceMaps` from the worker, allowing v8ToIstanbul to read in-memory sourcemaps directly without writeToDisk.

- Fixes 0% coverage bug where temp files couldn't be parsed from disk.

- Filters out generated temporary files (`.rstest-temp`) and webpack runtime code (`webpack/runtime`) from the final CoverageMap report.
colinaaa and others added 10 commits March 30, 2026 15:48
…inal source paths to fix file ignoring

Refactors the v8 coverage provider to apply include/exclude rules on the source-mapped files rather than transpiled V8 file URLs. This fixes the issue where test and fixture files were incorrectly showing up with 100% coverage in reports. Also updates corresponding e2e test assertions and snapshots to match the correct V8 output metrics.
@9aoy 9aoy changed the title feat: implement V8 coverage provider fix(coverage): filter temp output from v8 coverage summary May 7, 2026
@9aoy 9aoy changed the title fix(coverage): filter temp output from v8 coverage summary feat: implement V8 coverage provider May 7, 2026
9aoy added 2 commits May 13, 2026 15:08
Resolve conflicts around V8 coverage provider, changed coverage filtering, CLI options, and lockfile dependencies.
@9aoy

9aoy commented May 18, 2026

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6cce5a6690

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/coverage-v8/src/provider.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f8e0ea81b6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/core/src/cli/commands.ts Outdated
Comment thread packages/coverage-v8/src/provider.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6e5a8d98e0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/coverage-v8/src/provider.ts Outdated
Comment thread packages/coverage-v8/src/provider.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1e8957c7e3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/core/src/cli/init.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e61c0d1f8c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/core/src/coverage/generate.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2da92c2fcf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/coverage-v8/src/provider.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b2a9126863

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/core/src/cli/commands.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c35736e889

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/core/src/runtime/worker/runInPool.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 469d8c8f8f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/coverage-v8/src/provider.ts Outdated
Comment thread packages/core/src/coverage/generate.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b47ba86d8e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/coverage-v8/src/provider.ts
@9aoy 9aoy requested a review from fi3ework May 21, 2026 08:18
# Conflicts:
#	website/docs/en/guide/migration/vitest.mdx
#	website/docs/zh/guide/migration/vitest.mdx
@9aoy 9aoy merged commit 0296eef into web-infra-dev:main May 21, 2026
11 checks passed
This was referenced May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants