Skip to content

test: rewrite chai to assert#7134

Merged
BridgeAR merged 5 commits intomasterfrom
BridgeAR/2025-12-18-rewrite-chai-to-assert
Dec 18, 2025
Merged

test: rewrite chai to assert#7134
BridgeAR merged 5 commits intomasterfrom
BridgeAR/2025-12-18-rewrite-chai-to-assert

Conversation

@BridgeAR
Copy link
Copy Markdown
Member

These changes are done with a script. The script is visible in another commit that is reverted.

Manual fixes will be pushed after checking test failures.

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.78%. Comparing base (8822838) to head (2c6382a).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7134      +/-   ##
==========================================
+ Coverage   77.88%   84.78%   +6.90%     
==========================================
  Files         379      521     +142     
  Lines       17620    22155    +4535     
==========================================
+ Hits        13723    18785    +5062     
+ Misses       3897     3370     -527     

☔ 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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 18, 2025

Overall package size

Self size: 4.35 MB
Deduped: 5.18 MB
No deduping: 5.18 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 2.0.0 | 68.46 kB | 797.03 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |

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

@datadog-official

This comment has been minimized.

@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented Dec 18, 2025

Benchmarks

Benchmark execution time: 2025-12-18 18:47:03

Comparing candidate commit 2c6382a in PR branch BridgeAR/2025-12-18-rewrite-chai-to-assert with baseline commit 8822838 in branch master.

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

@BridgeAR BridgeAR marked this pull request as ready for review December 18, 2025 04:39
@BridgeAR BridgeAR requested review from a team as code owners December 18, 2025 04:39
@BridgeAR BridgeAR requested review from khanayan123 and removed request for a team December 18, 2025 04:39
Comment on lines +70 to +71
sinon.assert.calledOnceWithMatch(addSub, channelName)
sinon.assert.calledOnceWithExactly(getAndRegisterSubscription, { channelName, tag, tagKey: TagKey.SOURCE_TYPE })
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: why is one converted to calledOnceWithMatch and the other to calledOnceWithExactly ? just because otherwise the test fails ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes

Comment on lines +83 to +87
assert.strictEqual(rootSpan.setTag.getCall(0).calledWithExactly('usr.id', '123'), true)
assert.strictEqual(rootSpan.setTag.getCall(1).calledWithExactly('usr.email', 'a@b.c'), true)
assert.strictEqual(rootSpan.setTag.getCall(2).calledWithExactly('usr.custom', 'hello'), true)
assert.strictEqual(rootSpan.setTag.getCall(3).calledWithExactly('usr.session_id', '133769'), true)
assert.strictEqual(rootSpan.setTag.getCall(4).calledWithExactly('_dd.appsec.user.collection_mode', 'sdk'), true)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Doesn't that work better ?

sinon.assert.calledWithExactly(rootSpan.setTag.getCall(0), 'usr.id', '123')

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Both works. I did not look into all transformations if they are perfect as long as they keep the overall behavior as expected.

Copy link
Copy Markdown
Collaborator

@watson watson left a comment

Choose a reason for hiding this comment

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

Great work 💯

The comments apply to all changes, but I mostly only added them the first time I saw a specific pattern.

Comment thread integration-tests/playwright/playwright.spec.js Outdated
Comment thread packages/datadog-instrumentations/test/helpers/check-require-cache.spec.js Outdated
Comment thread packages/dd-trace/test/appsec/iast/overhead-controller.spec.js
Comment thread packages/dd-trace/test/openfeature/writers/exposures.spec.js Outdated
@BridgeAR BridgeAR requested a review from a team as a code owner December 18, 2025 17:23
@BridgeAR BridgeAR force-pushed the BridgeAR/2025-12-18-rewrite-chai-to-assert branch from 284584a to 2c6382a Compare December 18, 2025 18:38
@BridgeAR BridgeAR merged commit a1f53d8 into master Dec 18, 2025
793 checks passed
@BridgeAR BridgeAR deleted the BridgeAR/2025-12-18-rewrite-chai-to-assert branch December 18, 2025 19:00
dd-octo-sts Bot pushed a commit that referenced this pull request Dec 19, 2025
Automated rewrites including a lint:fix call.

Afterwards manual fixes and small improvements.
@dd-octo-sts dd-octo-sts Bot mentioned this pull request Dec 19, 2025
nina9753 pushed a commit that referenced this pull request Dec 20, 2025
Automated rewrites including a lint:fix call.

Afterwards manual fixes and small improvements.
nina9753 pushed a commit that referenced this pull request Jan 15, 2026
Automated rewrites including a lint:fix call.

Afterwards manual fixes and small improvements.
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.

3 participants