perf: use advanced serialization#792
Conversation
✅ Deploy Preview for rstest-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Rstest will drop Node 18 support in Rspack v2.0. Before that, a preview version can be released if needed. |
Which one do you mean? rstest or rspack? |
Rstest |
8a85aa5 to
386b111
Compare
There was a problem hiding this comment.
Pull request overview
This PR switches the core worker pool IPC to Tinypool’s advanced serialization to reduce overhead and avoid JSON serialization limits when transferring large payloads between the main process and workers.
Changes:
- Enable Tinypool
serialization: 'advanced'for worker pools and remove manualv8.serialize/v8.deserializeplumbing. - Stop manually “serializing” runtime config; adjust test collection/listing to pass
TestInfo(and includerunMode) instead of fullTestobjects. - Adjust coverage payload typing/shape to use
istanbul-lib-coverage’sFileCoverageData-based structure.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/core/src/types/testSuite.ts | Move runMode into info types and adjust coverage type for worker payloads. |
| packages/core/src/types/core.ts | Update list command result to return TestInfo[]. |
| packages/core/src/runtime/worker/rpc.ts | Remove custom v8 (de)serialization from Birpc options. |
| packages/core/src/runtime/worker/index.ts | Remove config “undo” step and adjust coverage attachment shape. |
| packages/core/src/runtime/runner/runner.ts | Include runMode in suite/case hook payloads. |
| packages/core/src/runtime/runner/index.ts | Centralize Test -> TestInfo mapping and include runMode. |
| packages/core/src/runtime/api/index.ts | Update runtime collectTests typing to TestInfo[]. |
| packages/core/src/pool/index.ts | Stop wrapping config for JSON and change collect results typing to TestInfo[]. |
| packages/core/src/pool/forks.ts | Enable Tinypool advanced serialization and remove v8 (de)serialization. |
| packages/core/src/core/listTests.ts | Traverse TestInfo for listing and use runMode filtering. |
| packages/core/src/core/globalSetup.ts | Enable advanced serialization for the global setup pool. |
| packages/core/src/browserRuntime.ts | Export TestInfo from browser-runtime types. |
| packages/browser/src/protocol.ts | Update browser protocol collect-result payload to TestInfo[]. |
| .vscode/tasks.json | Remove shared problem matcher block (VS Code task config change). |
Comments suppressed due to low confidence (1)
packages/core/src/pool/index.ts:165
createPoolnow declarescollectTestsreturnsTestInfo[], butcreateForksPool(packages/core/src/pool/forks.ts) still typescollectTestsas returningTest[].Testis not assignable toTestInfo(notablyTestSuite.testsisTest[], notTestInfo[]), so this should cause a TypeScript type mismatch and also contradicts the worker-side change to returnTestInfo[]. Update the forks pool return type (and any related imports/annotations) to useTestInfo[]for collect results to keep types consistent end-to-end.
}) => Promise<
{
tests: TestInfo[];
testPath: string;
errors?: FormattedError[];
project: string;
}[]
>;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
👍 |
Requires tinylibs/tinypool#128 to be merged.
Summary
Problem
When sending large files to worker, json serialization cost too much time.
It will even throw an error when the message is larger.
After switching to advanced serialization, the duration has significantly decreased.
Breaking changes
tinypoolv2.0.0 dropped Node 18 support.Changes
tinypoolto v2.1.0serializationto'advanced'Related Links
Checklist