Skip to content

Conversation

@bmeurer
Copy link
Contributor

@bmeurer bmeurer commented Jun 17, 2025

Purpose (TL;DR) - mandatory

For Chrome DevTools front-end testing we generally prefer the sinon.assert.foo(spy, ...) form over assert.isTrue(spy.foo(...)), and calledOnceWith is missing from the sinon.assert object currently.

Solution - optional

It's pretty straight-forward to also expose the calledOnceWith on the sinon.assert object.

How to verify - mandatory

  1. Check out this branch
  2. npm install
  3. npm test (specifically the test/assert-test.js file checks that the method is properly exposed)

Checklist for author

  • npm run lint passes
  • References to standard library functions are cached.

@codecov
Copy link

codecov bot commented Jun 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.82%. Comparing base (52b0d97) to head (9e9d050).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2660   +/-   ##
=======================================
  Coverage   95.82%   95.82%           
=======================================
  Files          39       39           
  Lines        1891     1892    +1     
=======================================
+ Hits         1812     1813    +1     
  Misses         79       79           
Flag Coverage Δ
unit 95.82% <100.00%> (+<0.01%) ⬆️

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.

@fatso83
Copy link
Contributor

fatso83 commented Jun 18, 2025

Hi, thanks for doing this! Could you also just run Prettier on the changes? seems to fail on that step.

@bmeurer bmeurer force-pushed the sinon-assert-calledOnceWith branch from 9e9d050 to 8d020a6 Compare June 18, 2025 05:36
@bmeurer
Copy link
Contributor Author

bmeurer commented Jun 18, 2025

Hi, thanks for doing this! Could you also just run Prettier on the changes? seems to fail on that step.

Done. Also added the method to the documentation.

@bmeurer
Copy link
Contributor Author

bmeurer commented Jun 18, 2025

Should be ready now.

@fatso83 fatso83 merged commit 80fa9a5 into sinonjs:main Jun 18, 2025
9 checks passed
@bmeurer bmeurer deleted the sinon-assert-calledOnceWith branch June 23, 2025 07:57
@bmeurer
Copy link
Contributor Author

bmeurer commented Jun 23, 2025

@mroderick @fatso83 thanks for merging the fix. Could you release a 21.1.0 version, so we start using this? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants