fix(cypress): handle missing beforeEach task result#9129
Conversation
Overall package sizeSelf size: 6.4 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: c07a671 | Docs | Datadog PR Page | Give us feedback! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #9129 +/- ##
==========================================
- Coverage 93.69% 93.69% -0.01%
==========================================
Files 889 889
Lines 50856 50861 +5
Branches 11830 11832 +2
==========================================
+ Hits 47649 47652 +3
- Misses 3207 3209 +2 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:
|
1f38dbc to
f8e612b
Compare
BenchmarksBenchmark execution time: 2026-06-29 10:04:33 Comparing candidate commit c07a671 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 2254 metrics, 32 unstable metrics.
|
f8e612b to
df3860b
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: df3860b440
ℹ️ 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
Cypress dd:beforeEach task now safely handles rare null/undefined returns with automatic retry and empty-object fallback. All downstream field destructuring uses defensive checks, eliminating the crash from the reported issue. The integration test correctly validates the retry path and successful test reporting. No regressions or defects identified.
📊 Validated against 8 scenarios · Open Bits AI session
🤖 Datadog Autotest · Commit df3860b · What is Autotest? · Any feedback? Reach out in #autotest
df3860b to
0a0817a
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0a0817ab5f
ℹ️ 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".
0a0817a to
3ce8a2a
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3ce8a2a716
ℹ️ 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".
3ce8a2a to
c07a671
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! 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 a defensive retry around the Cypress
dd:beforeEachtask result before destructuring it. If Cypress yieldsnullorundefined, the support hook now warns once and retriesdd:beforeEach; if the retry also has no result, it warns once more and continues with an empty result instead of failing the run with a destructuring error.Also makes the Node-side Cypress task handler idempotent for repeated ITR-skipped
dd:beforeEachcalls. When the missing-result edge happens after the task handler already ran, the retry no longer appends the same skipped test twice or inflatestest.itr.tests_skipping.count. The de-dupe key is scoped by spec path so Cypress runnable ids reused across spec files do not under-count distinct skipped tests.Integration coverage lives in the existing Cypress specs. The fixture now calls the real
dd:beforeEachhandler and then returnsnullon the first call, which simulates the sharper transport edge where task side effects already happened but Cypress yielded no result. The reporting test verifies the retry reaches the real task result, and the ITR test verifies two skipped specs are counted separately while the retried skipped test is counted once.Motivation
A user reported a rare Cypress failure where
cy.task("dd:beforeEach")yieldedundefined, causing the support hook to crash while destructuring the task result. The Datadog task handlers normally return an object, including noop fallback handlers, so this appears to be a rare Cypress/plugin task transport or lifecycle edge rather than an expected Datadog configuration path.Fixes #9084.