Skip to content

[test optimization] Fix cypress attempt to fix #7767

Open
juan-fernandez wants to merge 2 commits intomasterfrom
juan-fernandez/fix-cypress-attempt-to-fix-exit-code
Open

[test optimization] Fix cypress attempt to fix #7767
juan-fernandez wants to merge 2 commits intomasterfrom
juan-fernandez/fix-cypress-attempt-to-fix-exit-code

Conversation

@juan-fernandez
Copy link
Collaborator

What does this PR do?

Suppresses attempt-to-fix test failures in Cypress so the process exits with code 0, matching the test management spec. Also removes stale TODO comments for quarantine/disabled handling fixed in #7442.

Motivation

The spec requires that when a test is marked as "attempt to fix" and fails, the exit code should remain 0 — failures are ignored for session outcome. Quarantined tests already achieved this by catching errors in Cypress.on('fail') and not re-throwing. Attempt-to-fix tests were not getting the same treatment, causing Cypress to exit with code 1.

Additional Notes

The fix mirrors the existing quarantine pattern:

  • support.js: Catch errors for attempt-to-fix tests in Cypress.on('fail'), store them, and report state: 'failed' to Datadog in afterEach (so the actual result is preserved)
  • cypress-plugin.js: Prevent afterSpec from overwriting the reported fail status back to pass for attempt-to-fix tests
  • cypress.spec.js: Update exit code assertion to expect 0 when isAttemptToFix is true

…with code 0

When a test is marked as attempt-to-fix by test management and fails,
the spec requires exit code 0 (failures should be ignored for session
outcome). This extends the existing quarantine error suppression pattern
to also cover attempt-to-fix tests: errors are caught in Cypress.on('fail')
and not re-thrown, while the actual failure status is still reported to
Datadog via the afterEach hook.

Also removes stale TODO comments for quarantine/disabled handling that
were fixed in PR #7442.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Contributor

github-actions bot commented Mar 13, 2026

Overall package size

Self size: 4.97 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

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.42%. Comparing base (63a867a) to head (1882fe8).
⚠️ Report is 8 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7767      +/-   ##
==========================================
- Coverage   80.43%   80.42%   -0.02%     
==========================================
  Files         741      741              
  Lines       32173    32182       +9     
==========================================
+ Hits        25879    25882       +3     
- Misses       6294     6300       +6     
Flag Coverage Δ
aiguard-macos 39.09% <ø> (+0.15%) ⬆️
aiguard-ubuntu 39.21% <ø> (+0.15%) ⬆️
aiguard-windows 38.94% <ø> (+0.15%) ⬆️
apm-capabilities-tracing-macos 48.89% <ø> (-0.01%) ⬇️
apm-capabilities-tracing-ubuntu 48.93% <ø> (-0.01%) ⬇️
apm-capabilities-tracing-windows 48.67% <ø> (-0.01%) ⬇️
apm-integrations-child-process 38.39% <ø> (-0.10%) ⬇️
apm-integrations-couchbase-18 37.31% <ø> (-0.10%) ⬇️
apm-integrations-couchbase-eol 37.78% <ø> (-0.10%) ⬇️
apm-integrations-oracledb 37.62% <ø> (-0.10%) ⬇️
appsec-express 55.19% <ø> (-0.08%) ⬇️
appsec-fastify 51.54% <ø> (-0.07%) ⬇️
appsec-graphql 51.73% <ø> (-0.07%) ⬇️
appsec-kafka 44.27% <ø> (-0.08%) ⬇️
appsec-ldapjs 43.93% <ø> (-0.08%) ⬇️
appsec-lodash 43.59% <ø> (-0.08%) ⬇️
appsec-macos 58.21% <ø> (-0.07%) ⬇️
appsec-mongodb-core 48.70% <ø> (+0.03%) ⬆️
appsec-mongoose 49.36% <ø> (-0.08%) ⬇️
appsec-mysql 50.80% <ø> (-0.07%) ⬇️
appsec-node-serialize 43.11% <ø> (-0.08%) ⬇️
appsec-passport 47.55% <ø> (-0.09%) ⬇️
appsec-postgres 50.52% <ø> (-0.09%) ⬇️
appsec-sourcing 42.51% <ø> (-0.08%) ⬇️
appsec-template 43.27% <ø> (-0.08%) ⬇️
appsec-ubuntu 58.29% <ø> (-0.07%) ⬇️
appsec-windows 58.05% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-bluebird 32.26% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-body-parser 40.41% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-child_process 37.71% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-cookie-parser 34.24% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-express 34.56% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-express-mongo-sanitize 34.37% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-express-session 40.05% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-fs 31.88% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-generic-pool 29.69% <ø> (ø)
instrumentations-instrumentation-http 39.69% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-knex 32.27% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-mongoose 33.39% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-multer 40.16% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-mysql2 38.17% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-passport 43.97% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-passport-http 43.64% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-passport-local 44.17% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-pg 37.60% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-promise 32.19% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-promise-js 32.20% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-q 32.24% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-url 32.17% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-when 32.21% <ø> (-0.10%) ⬇️
llmobs-ai 42.15% <ø> (-0.09%) ⬇️
llmobs-anthropic 40.14% <ø> (-0.09%) ⬇️
llmobs-bedrock 39.13% <ø> (-0.08%) ⬇️
llmobs-google-genai 39.69% <ø> (-0.09%) ⬇️
llmobs-langchain 39.93% <ø> (-0.08%) ⬇️
llmobs-openai 43.87% <ø> (-0.09%) ⬇️
llmobs-vertex-ai 39.94% <ø> (-0.09%) ⬇️
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.18% <ø> (-0.03%) ⬇️
plugins-cassandra 37.80% <ø> (+0.04%) ⬆️
plugins-cookie 26.89% <ø> (ø)
plugins-cookie-parser 26.67% <ø> (ø)
plugins-crypto 26.79% <ø> (ø)
plugins-dd-trace-api 38.22% <ø> (-0.10%) ⬇️
plugins-express-mongo-sanitize 26.82% <ø> (ø)
plugins-express-session 26.63% <ø> (ø)
plugins-fastify 42.13% <ø> (-0.09%) ⬇️
plugins-fetch 38.22% <ø> (-0.09%) ⬇️
plugins-fs 38.49% <ø> (-0.10%) ⬇️
plugins-generic-pool 25.87% <ø> (ø)
plugins-google-cloud-pubsub 45.34% <ø> (-0.09%) ⬇️
plugins-grpc 40.81% <ø> (-0.09%) ⬇️
plugins-handlebars 26.86% <ø> (ø)
plugins-hapi 40.04% <ø> (-0.10%) ⬇️
plugins-hono 40.30% <ø> (-0.10%) ⬇️
plugins-ioredis 38.30% <ø> (-0.10%) ⬇️
plugins-knex 26.50% <ø> (ø)
plugins-ldapjs 24.36% <ø> (ø)
plugins-light-my-request 26.23% <ø> (ø)
plugins-limitd-client 32.54% <ø> (-0.10%) ⬇️
plugins-lodash 25.96% <ø> (ø)
plugins-mariadb 39.35% <ø> (-0.10%) ⬇️
plugins-memcached 38.03% <ø> (-0.10%) ⬇️
plugins-microgateway-core 39.11% <ø> (-0.10%) ⬇️
plugins-moleculer 40.40% <ø> (-0.09%) ⬇️
plugins-mongodb 39.05% <ø> (-0.10%) ⬇️
plugins-mongodb-core 38.88% <ø> (-0.10%) ⬇️
plugins-mongoose 38.74% <ø> (-0.10%) ⬇️
plugins-multer 26.63% <ø> (ø)
plugins-mysql 39.04% <ø> (-0.10%) ⬇️
plugins-mysql2 39.14% <ø> (-0.10%) ⬇️
plugins-node-serialize 26.93% <ø> (ø)
plugins-opensearch 37.49% <ø> (-0.10%) ⬇️
plugins-passport-http 26.68% <ø> (ø)
plugins-postgres 35.53% <ø> (-0.09%) ⬇️
plugins-process 26.79% <ø> (ø)
plugins-pug 26.89% <ø> (ø)
plugins-redis 38.77% <ø> (-0.10%) ⬇️
plugins-router 42.99% <ø> (+0.04%) ⬆️
plugins-sequelize 25.47% <ø> (ø)
plugins-test-and-upstream-amqp10 38.38% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-amqplib 43.76% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-apollo 39.01% <ø> (-0.09%) ⬇️
plugins-test-and-upstream-avsc 38.55% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-bunyan 33.80% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-connect 40.70% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-graphql 40.00% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-koa 40.29% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-protobufjs 38.78% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-rhea 43.97% <ø> (-0.07%) ⬇️
plugins-undici 38.99% <ø> (-0.09%) ⬇️
plugins-url 26.79% <ø> (ø)
plugins-valkey 37.97% <ø> (-0.10%) ⬇️
plugins-vm 26.79% <ø> (ø)
plugins-winston 33.99% <ø> (-0.10%) ⬇️
plugins-ws 41.76% <ø> (-0.10%) ⬇️
profiling-macos 39.80% <ø> (-0.10%) ⬇️
profiling-ubuntu 39.92% <ø> (-0.10%) ⬇️
profiling-windows 41.51% <ø> (+0.30%) ⬆️
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-5

This comment has been minimized.

@pr-commenter
Copy link

pr-commenter bot commented Mar 13, 2026

Benchmarks

Benchmark execution time: 2026-03-13 11:19:44

Comparing candidate commit 6fb9668 in PR branch juan-fernandez/fix-cypress-attempt-to-fix-exit-code with baseline commit 63a867a in branch master.

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

… changes

Adding lines to support.js shifts line numbers in Cypress's bundled
output. The invocationDetails test hardcodes the expected source line,
which moved from 246 to 255.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@juan-fernandez juan-fernandez marked this pull request as ready for review March 13, 2026 15:54
@juan-fernandez juan-fernandez requested a review from a team as a code owner March 13, 2026 15:54
Copy link
Member

@anmarchenko anmarchenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In spec we ignore the failure for attempt to fix only if test is quarantined or disbaled:

If test is tagged with test.test_management.is_test_disabled or test.test_management.is_quarantined tag, then the test results are ignored (reported to the test framework as skipped, passed, or quarantined, whatever is easier to implement and available in the test framework) 

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