perf(coverage-v8): resolve raw coverage in main process#1501
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 46d03596ac
ℹ️ 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".
There was a problem hiding this comment.
Pull request overview
This PR improves performance of V8 coverage finalization by shifting AST-based conversion work out of workers and into the main process: workers emit lightweight raw coverage payloads, the pool forwards them separately, and the main process resolves/merges them once before report generation. It also adds a “slow processing” hint when coverage resolution takes noticeable time.
Changes:
- Add a raw-coverage collection/resolution path (
collectRaw()/resolveRawCoverage()) for the V8 coverage provider and validate merging behavior with a new unit test. - Plumb raw coverage payloads from worker → pool → main process, resolving them once before report generation.
- Extend core public types to reflect the new raw-coverage workflow and add lifecycle slow-step messaging.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/coverage-v8/src/provider.ts | Introduces raw payload collection + main-process resolution/merge logic; refactors option/source handling for reuse. |
| packages/coverage-v8/tests/provider.test.ts | Adds a test ensuring raw payloads merge before conversion to Istanbul format. |
| packages/core/src/runtime/worker/runInPool.ts | Switches worker coverage collection to prefer collectRaw() with fallback to collect(). |
| packages/core/src/pool/index.ts | Adds a dedicated callback path to forward raw coverage results and strips them at the pool boundary. |
| packages/core/src/core/runTests.ts | Collects raw coverage payloads and resolves them once in the main process before reporter/report generation, with slow-step logging. |
| packages/core/src/types/{coverage.ts,testSuite.ts} | Updates public type surface for raw coverage hooks and raw coverage results field. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 48a0fd8bf7
ℹ️ 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".
Deploying rstest with
|
| Latest commit: |
36d400e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://2a680a0d.rstest.pages.dev |
| Branch Preview URL: | https://9aoy-coverage-v8-resolve-raw.rstest.pages.dev |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 36d400e314
ℹ️ 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".
Summary
This PR optimizes V8 coverage finalization on top of the existing AST converter and raw-entry filtering path. Workers now return lightweight raw coverage payloads through
collectRaw(), the pool forwards those payloads separately from normal test results, and the main process resolves all raw payloads once throughresolveRawCoverage()before report generation. Istanbul keeps the existing worker-sidecollect()fallback, and slow coverage finalization now shows a processing hint when it takes more than 1s.Performance on
rsbuildwithtime pnpm test --coverage --coverage.provider v8 --coverage.reporters=json-summary(5-run median):4.35s -> 3.82s(-12.2%, 1.14x faster)3192ms -> 1581ms(-50.5%, 2.02x faster)29.95s -> 12.87s(-57.0%)5.20s -> 3.28s(-36.9%)31.67/21.45/31.79/32.32 -> 31.65/21.45/31.67/32.32Related Links
#1490
Checklist