Skip to content

[test optimization] Fix TIA in parallel mocha #7773

Open
juan-fernandez wants to merge 2 commits intojuan-fernandez/mocha-parallel-atr-and-atffrom
juan-fernandez/mocha-parallel-itr-suite-skipping
Open

[test optimization] Fix TIA in parallel mocha #7773
juan-fernandez wants to merge 2 commits intojuan-fernandez/mocha-parallel-atr-and-atffrom
juan-fernandez/mocha-parallel-itr-suite-skipping

Conversation

@juan-fernandez
Copy link
Collaborator

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

What does this PR do?

⚠️ Do not merge until #7772 is merged

Enables ITR suite skipping in Mocha's parallel mode by filtering the file list before dispatching to workers.

Motivation

Suite skipping was the last feature gated off for parallel mode. The remote config was already available before workers start (via getExecutionConfiguration in the ParallelBufferedRunner.run hook), but the serial-mode skipping mechanism — mutating runner.suite.suites — doesn't apply in parallel mode because suites aren't loaded in the main process.

Additional Notes

  • In parallel mode, suites are skipped by filtering the files array before calling run.apply, rather than removing loaded suites from runner.suite.suites.
  • skippedSuites is populated before run.apply so the itr:skipped-suites channel emits proper skip spans for filtered files on the start event.
  • unskippableSuites is populated from files before config is fetched, matching the serial mode pattern.
  • Removed the !isParallel && gate on isSuitesSkippingEnabled and the !isParallel guard on itrSkippedSuitesCh.publish.

@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

@pr-commenter
Copy link

pr-commenter bot commented Mar 13, 2026

Benchmarks

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

Comparing candidate commit 95d02d7 in PR branch juan-fernandez/mocha-parallel-itr-suite-skipping with baseline commit 2aaca65 in branch juan-fernandez/mocha-parallel-atr-and-atf.

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

@codecov
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

❌ Patch coverage is 5.00000% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.38%. Comparing base (7d0fe01) to head (d723325).

Files with missing lines Patch % Lines
...ackages/datadog-instrumentations/src/mocha/main.js 0.00% 19 Missing ⚠️
Additional details and impacted files
@@                              Coverage Diff                              @@
##           juan-fernandez/mocha-parallel-atr-and-atf    #7773      +/-   ##
=============================================================================
- Coverage                                      80.42%   80.38%   -0.04%     
=============================================================================
  Files                                            741      741              
  Lines                                          32176    32192      +16     
=============================================================================
  Hits                                           25876    25876              
- Misses                                          6300     6316      +16     
Flag Coverage Δ
aiguard-macos 38.83% <ø> (ø)
aiguard-ubuntu 38.95% <ø> (ø)
aiguard-windows 38.68% <ø> (ø)
apm-capabilities-tracing-macos 48.90% <100.00%> (ø)
apm-capabilities-tracing-ubuntu 48.94% <100.00%> (ø)
apm-capabilities-tracing-windows 48.66% <100.00%> (-0.01%) ⬇️
apm-integrations-child-process 38.39% <ø> (ø)
apm-integrations-couchbase-18 37.31% <ø> (ø)
apm-integrations-couchbase-eol 37.81% <ø> (+0.02%) ⬆️
apm-integrations-oracledb 37.62% <ø> (ø)
appsec-express 55.22% <ø> (+0.02%) ⬆️
appsec-fastify 51.54% <ø> (ø)
appsec-graphql 51.74% <ø> (+<0.01%) ⬆️
appsec-kafka 44.27% <ø> (-0.01%) ⬇️
appsec-ldapjs 43.93% <ø> (ø)
appsec-lodash 43.59% <ø> (ø)
appsec-macos 58.14% <5.00%> (-0.06%) ⬇️
appsec-mongodb-core 48.70% <ø> (ø)
appsec-mongoose 49.37% <ø> (+<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.21% <5.00%> (-0.06%) ⬇️
appsec-windows 58.00% <5.00%> (-0.04%) ⬇️
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.56% <5.00%> (-0.11%) ⬇️
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% <ø> (ø)
plugins-passport-http 26.68% <ø> (ø)
plugins-postgres 35.47% <5.00%> (-0.05%) ⬇️
plugins-process 26.79% <ø> (ø)
plugins-pug 26.89% <ø> (ø)
plugins-redis 38.77% <ø> (ø)
plugins-router 42.85% <ø> (ø)
plugins-sequelize 25.47% <ø> (ø)
plugins-test-and-upstream-amqp10 38.38% <ø> (ø)
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% <ø> (ø)
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 40.33% <ø> (+0.40%) ⬆️
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-prod-us1-6
Copy link

datadog-prod-us1-6 bot commented Mar 13, 2026

⚠️ Tests

Fix all issues with BitsAI or with Cursor

⚠️ Warnings

🧪 2 Tests 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:

'1' !== undefined

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:

'1' !== 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: d723325 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback!

@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 and others added 2 commits March 13, 2026 17:01
Filter files in ParallelBufferedRunner.run before dispatching to workers,
instead of mutating runner.suite.suites (which is empty in parallel mode).
Populate skippedSuites so the itr:skipped-suites channel emits proper
skip spans for filtered files.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Now that ITR suite skipping works in parallel mode, remove the
capability gate so the backend knows Mocha supports TIA 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-itr-suite-skipping branch from 95d02d7 to d723325 Compare March 13, 2026 16:01
@juan-fernandez juan-fernandez marked this pull request as ready for review March 13, 2026 16:02
@juan-fernandez juan-fernandez requested a review from a team as a code owner March 13, 2026 16:02
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.

1 participant