Skip to content

[test optimization] Fix attempt to fix in mocha parallel mode #7772

Open
juan-fernandez wants to merge 2 commits intojuan-fernandez/fix-mocha-parallel-retry-statusfrom
juan-fernandez/mocha-parallel-atr-and-atf
Open

[test optimization] Fix attempt to fix in mocha parallel mode #7772
juan-fernandez wants to merge 2 commits intojuan-fernandez/fix-mocha-parallel-retry-statusfrom
juan-fernandez/mocha-parallel-atr-and-atf

Conversation

@juan-fernandez
Copy link
Collaborator

@juan-fernandez juan-fernandez commented Mar 13, 2026

What does this PR do?

⚠️ Do not merge until #7768 is merged

Enables Attempt to Fix (ATF) in Mocha's parallel mode by wiring up testManagementAttemptToFixRetries from the main process to workers.

Motivation

Building on the base branch which added the retry handler and ATR support to parallel workers, ATF was the only retry-based feature still disabled for parallel mode. The config just needed to be uncommented and passed to workers following the same pattern already used by other features.

Additional Notes

  • Uncommented _ddTestManagementAttemptToFixRetries config passthrough in both main.js (BufferedWorkerPool.run hook) and worker.js (Mocha.prototype.run hook).
  • Removed stale "Flaky test retries does not work in parallel mode" comment in utils.js.
  • ITR / suite skipping remains unsupported in parallel mode (requires options.delay which Mocha doesn't support in parallel).

@github-actions
Copy link
Contributor

github-actions bot commented Mar 13, 2026

Overall package size

Self size: 4.96 MB
Deduped: 5.81 MB
No deduping: 5.81 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.0.0 | 81.15 kB | 815.98 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@codecov
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 80.42%. Comparing base (25d1ff6) to head (7d0fe01).

Files with missing lines Patch % Lines
...ackages/datadog-instrumentations/src/mocha/main.js 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                               Coverage Diff                               @@
##           juan-fernandez/fix-mocha-parallel-retry-status    #7772   +/-   ##
===============================================================================
  Coverage                                           80.41%   80.42%           
===============================================================================
  Files                                                 741      741           
  Lines                                               32185    32176    -9     
===============================================================================
- Hits                                                25883    25876    -7     
+ Misses                                               6302     6300    -2     
Flag Coverage Δ
aiguard-macos 38.83% <ø> (-0.26%) ⬇️
aiguard-ubuntu 38.95% <ø> (-0.26%) ⬇️
aiguard-windows 38.68% <ø> (-0.26%) ⬇️
apm-capabilities-tracing-macos 48.90% <100.00%> (+<0.01%) ⬆️
apm-capabilities-tracing-ubuntu 48.94% <100.00%> (+<0.01%) ⬆️
apm-capabilities-tracing-windows 48.67% <100.00%> (+<0.01%) ⬆️
apm-integrations-child-process 38.39% <ø> (ø)
apm-integrations-couchbase-18 37.31% <ø> (ø)
apm-integrations-couchbase-eol 37.78% <ø> (ø)
apm-integrations-oracledb 37.62% <ø> (ø)
appsec-express 55.19% <ø> (-0.01%) ⬇️
appsec-fastify 51.54% <ø> (ø)
appsec-graphql 51.73% <ø> (-0.01%) ⬇️
appsec-kafka 44.28% <ø> (+<0.01%) ⬆️
appsec-ldapjs 43.93% <ø> (ø)
appsec-lodash 43.59% <ø> (ø)
appsec-macos 58.20% <50.00%> (-0.01%) ⬇️
appsec-mongodb-core 48.70% <ø> (ø)
appsec-mongoose 49.36% <ø> (-0.01%) ⬇️
appsec-mysql 50.80% <ø> (ø)
appsec-node-serialize 43.11% <ø> (ø)
appsec-passport 47.55% <ø> (ø)
appsec-postgres 50.52% <ø> (ø)
appsec-sourcing 42.51% <ø> (ø)
appsec-template 43.27% <ø> (ø)
appsec-ubuntu 58.27% <50.00%> (-0.01%) ⬇️
appsec-windows 58.03% <50.00%> (-0.02%) ⬇️
instrumentations-instrumentation-bluebird 32.26% <ø> (ø)
instrumentations-instrumentation-body-parser 40.41% <ø> (ø)
instrumentations-instrumentation-child_process 37.71% <ø> (ø)
instrumentations-instrumentation-cookie-parser 34.24% <ø> (ø)
instrumentations-instrumentation-express 34.56% <ø> (ø)
instrumentations-instrumentation-express-mongo-sanitize 34.37% <ø> (ø)
instrumentations-instrumentation-express-session 40.05% <ø> (ø)
instrumentations-instrumentation-fs 31.88% <ø> (ø)
instrumentations-instrumentation-generic-pool 29.67% <50.00%> (-0.01%) ⬇️
instrumentations-instrumentation-http 39.69% <ø> (ø)
instrumentations-instrumentation-knex 32.27% <ø> (ø)
instrumentations-instrumentation-mongoose 33.39% <ø> (ø)
instrumentations-instrumentation-multer 40.16% <ø> (ø)
instrumentations-instrumentation-mysql2 38.17% <ø> (ø)
instrumentations-instrumentation-passport 43.97% <ø> (ø)
instrumentations-instrumentation-passport-http 43.64% <ø> (ø)
instrumentations-instrumentation-passport-local 44.17% <ø> (ø)
instrumentations-instrumentation-pg 37.60% <ø> (ø)
instrumentations-instrumentation-promise 32.19% <ø> (ø)
instrumentations-instrumentation-promise-js 32.20% <ø> (ø)
instrumentations-instrumentation-q 32.24% <ø> (ø)
instrumentations-instrumentation-url 32.17% <ø> (ø)
instrumentations-instrumentation-when 32.21% <ø> (ø)
llmobs-ai 42.15% <ø> (ø)
llmobs-anthropic 40.14% <ø> (ø)
llmobs-bedrock 39.13% <ø> (ø)
llmobs-google-genai 39.69% <ø> (ø)
llmobs-langchain 39.93% <ø> (ø)
llmobs-openai 43.87% <ø> (ø)
llmobs-vertex-ai 39.94% <ø> (ø)
platform-core 31.53% <ø> (ø)
platform-esbuild 34.48% <ø> (ø)
platform-instrumentations-misc 48.40% <ø> (ø)
platform-shimmer 37.63% <ø> (ø)
platform-unit-guardrails 32.95% <ø> (ø)
plugins-azure-event-hubs 25.83% <ø> (ø)
plugins-azure-service-bus 25.19% <ø> (ø)
plugins-bullmq 44.07% <ø> (ø)
plugins-cassandra 37.66% <ø> (ø)
plugins-cookie 26.89% <ø> (ø)
plugins-cookie-parser 26.67% <ø> (ø)
plugins-crypto 26.79% <ø> (ø)
plugins-dd-trace-api 38.22% <ø> (ø)
plugins-express-mongo-sanitize 26.82% <ø> (ø)
plugins-express-session 26.63% <ø> (ø)
plugins-fastify 42.13% <ø> (ø)
plugins-fetch 38.22% <ø> (ø)
plugins-fs 38.49% <ø> (ø)
plugins-generic-pool 25.87% <ø> (ø)
plugins-google-cloud-pubsub 45.34% <ø> (ø)
plugins-grpc 40.81% <ø> (ø)
plugins-handlebars 26.86% <ø> (ø)
plugins-hapi 40.04% <ø> (ø)
plugins-hono 40.30% <ø> (ø)
plugins-ioredis 38.30% <ø> (ø)
plugins-knex 26.50% <ø> (ø)
plugins-ldapjs 24.36% <ø> (ø)
plugins-light-my-request 26.23% <ø> (ø)
plugins-limitd-client 32.54% <ø> (ø)
plugins-lodash 25.96% <ø> (ø)
plugins-mariadb 39.35% <ø> (ø)
plugins-memcached 38.03% <ø> (ø)
plugins-microgateway-core 39.11% <ø> (ø)
plugins-moleculer 40.40% <ø> (ø)
plugins-mongodb 39.05% <ø> (ø)
plugins-mongodb-core 38.88% <ø> (ø)
plugins-mongoose 38.74% <ø> (ø)
plugins-multer 26.63% <ø> (ø)
plugins-mysql 39.04% <ø> (ø)
plugins-mysql2 39.14% <ø> (ø)
plugins-node-serialize 26.93% <ø> (ø)
plugins-opensearch 37.49% <ø> (+<0.01%) ⬆️
plugins-passport-http 26.68% <ø> (ø)
plugins-postgres 35.52% <50.00%> (-0.01%) ⬇️
plugins-process 26.79% <ø> (ø)
plugins-pug 26.89% <ø> (ø)
plugins-redis 38.77% <ø> (ø)
plugins-router 42.85% <ø> (-0.14%) ⬇️
plugins-sequelize 25.47% <ø> (ø)
plugins-test-and-upstream-amqp10 38.38% <ø> (+0.14%) ⬆️
plugins-test-and-upstream-amqplib 43.76% <ø> (ø)
plugins-test-and-upstream-apollo 39.01% <ø> (ø)
plugins-test-and-upstream-avsc 38.55% <ø> (ø)
plugins-test-and-upstream-bunyan 33.80% <ø> (ø)
plugins-test-and-upstream-connect 40.70% <ø> (ø)
plugins-test-and-upstream-graphql 40.00% <ø> (ø)
plugins-test-and-upstream-koa 40.29% <ø> (ø)
plugins-test-and-upstream-protobufjs 38.78% <ø> (ø)
plugins-test-and-upstream-rhea 43.97% <ø> (+0.02%) ⬆️
plugins-undici 38.99% <ø> (ø)
plugins-url 26.79% <ø> (ø)
plugins-valkey 37.97% <ø> (ø)
plugins-vm 26.79% <ø> (ø)
plugins-winston 33.99% <ø> (ø)
plugins-ws 41.76% <ø> (ø)
profiling-macos 39.80% <ø> (ø)
profiling-ubuntu 39.92% <ø> (ø)
profiling-windows 41.51% <ø> (ø)
serverless-azure-functions-client 25.54% <ø> (ø)
serverless-azure-functions-eventhubs 25.54% <ø> (ø)
serverless-azure-functions-servicebus 25.54% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@datadog-official
Copy link

datadog-official bot commented Mar 13, 2026

⚠️ Tests

Fix all issues with BitsAI or with Cursor

⚠️ Warnings

🧪 1 Test failed

mocha@latest libraries capabilities adds capabilities to tests (parallel) from integration-tests/mocha/mocha.spec.js (Datadog) (Fix with Cursor)
Expected values to be strictly equal:

'5' !== undefined

ℹ️ Info

No other issues found (see more)

❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 7d0fe01 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback!

@pr-commenter
Copy link

pr-commenter bot commented Mar 13, 2026

Benchmarks

Benchmark execution time: 2026-03-13 13:03:33

Comparing candidate commit 6ad2e8a in PR branch juan-fernandez/mocha-parallel-atr-and-atf with baseline commit db2ea3e in branch juan-fernandez/fix-mocha-parallel-retry-status.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 233 metrics, 27 unstable metrics.

juan-fernandez and others added 2 commits March 13, 2026 16:57
Uncomment and wire up testManagementAttemptToFixRetries config flow
from main process to workers. Also remove stale comment in utils.js
about flaky test retries not working in parallel mode.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ARALLEL_MODE

Now that attempt-to-fix works in parallel mode, remove the capability
gate so the backend knows Mocha supports ATF in parallel.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@juan-fernandez juan-fernandez force-pushed the juan-fernandez/mocha-parallel-atr-and-atf branch from 6ad2e8a to 7d0fe01 Compare March 13, 2026 15:57
@juan-fernandez juan-fernandez marked this pull request as ready for review March 13, 2026 15:59
@juan-fernandez juan-fernandez requested a review from a team as a code owner March 13, 2026 15:59
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.

2 participants