feat(test-optimization): add vitest no-worker init mode#9173
Conversation
Overall package sizeSelf size: 6.51 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.2.0 | 104.26 kB | 843.44 kB | | opentracing | 0.14.7 | 194.81 kB | 194.81 kB | | dc-polyfill | 0.1.11 | 25.74 kB | 25.74 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: d99a8c2 | Docs | Datadog PR Page | Give us feedback! |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #9173 +/- ##
==========================================
- Coverage 93.73% 93.63% -0.11%
==========================================
Files 895 896 +1
Lines 51398 52223 +825
Branches 11980 12265 +285
==========================================
+ Hits 48178 48899 +721
- Misses 3220 3324 +104
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
BenchmarksBenchmark execution time: 2026-07-02 12:05:34 Comparing candidate commit d99a8c2 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 2263 metrics, 23 unstable metrics.
|
1308459 to
892fd05
Compare
892fd05 to
d0c7393
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d0c73936f8
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 736ba3ddea
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 00b81c7fda
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b2d3fa88ac
ℹ️ 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".
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d8398c8ec0
ℹ️ 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.
More details
Node_OPTIONS stripping, configureWorkerEnv, shouldUse version/isolate fallbacks, and getLibraryCapabilitiesTags FTR-omission logic all behave correctly across 30+ adversarial scenarios including quoted paths with spaces, Windows-style paths, multiple consecutive DD flags, absolute paths, and the -r/--require/--import=value forms. The operator-precedence on the new !omitFailedTestReplay && isFtrSupported ? '1' : undefined expression is correct (&& binds tighter than ?:). No defects found.
📊 Validated against 34 scenarios · Open Bits AI session
🤖 Datadog Autotest · Commit d8398c8 · What is Autotest? · Any feedback? Reach out in #autotest
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
What does this PR do?
Adds the opt-in Vitest no-worker-init mode behind
DD_EXPERIMENTAL_TEST_OPT_VITEST_NO_WORKER_INIT.When enabled for supported isolated Vitest worker-pool runs, the main Vitest instrumentation delegates the experimental path to
vitest-main-no-worker-init. That path injectsci/vitest-no-worker-init-setup.mjs, marks Vitest workers withDD_TEST_OPT_VITEST_NO_WORKER_INIT_ACTIVE, strips Datadog Test Optimization bootstraps from workerNODE_OPTIONS, and reports Vitest suite/test events from the main-process reporter path.ci/initand the Vitest instrumentation entrypoint skip loadingdd-traceinside marked Vitest workers. The injected setup file preserves the worker-side Test Optimization behavior that still needs to happen without initializing the tracer there, including Test Management skips/quarantine/attempt-to-fix metadata, Auto Test Retries metadata, user-configured Vitest retry metadata, Early Flake Detection retry metadata, impacted-test metadata, and ordinary passing-test durations.Because
dd-traceis not initialized inside Vitest workers in this mode, features that require an active test span inside test code are not supported. This includes custom test tags, custom spans attached to the active test span, log correlation from test code, and Failed Test Replay. Failed Test Replay capability metadata and session telemetry are disabled while no-worker-init mode is active.The mode supports both forks and threads for Vitest
>=3.2.6. It falls back to normal Vitest worker instrumentation when the flag is used with older Vitest versions, disabled isolation, non-worker pools, or mixed worker/non-worker selected specs.Motivation
Reduce Vitest worker startup overhead for Test Optimization by avoiding full tracer initialization in workers while preserving reporting and test-modifying behavior for supported isolated worker-pool runs.
Additional Notes
Benchmark scenario: 200 Vitest files, 3 tests per file, test durations from 10ms to 100ms, Vitest
4.1.9.Reporting parity passed in both benchmark runs: normal and no-worker-init both reported 600 tests, 200 suites, 1 module, and 1 session, with matching test names and suite names.
Validation:
./node_modules/.bin/mocha --timeout 60000 integration-tests/vitest/vitest.no-worker-init.spec.jsnpm run lintgit diff --check