sinonjs / sinon

Test spies, stubs and mocks for JavaScript.
https://sinonjs.org/
Other
9.67k stars 769 forks source link

fix(2525): ensure non empty message when error of type string is passed, but no message #2544

Closed peanutenthusiast closed 1 year ago

peanutenthusiast commented 1 year ago

Purpose (TL;DR) - mandatory

When an error of type String and an undefined message are passed to throwsException, ensure a non-empty error.message

See issue: #2525

How to verify - mandatory

  1. Check out this branch
  2. npm install
  3. npm test

Checklist for author

Note: The branch currently causes this test to fail, so I'd appreciate guidance on whether expectations change, given this will result in a major semver change.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 85.71% and project coverage change: -0.09% :warning:

Comparison is base (2ddf7ff) 96.03% compared to head (fc58ed5) 95.95%. Report is 3 commits behind head on main.

:exclamation: Current head fc58ed5 differs from pull request most recent head 4267025. Consider uploading reports for the commit 4267025 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2544 +/- ## ========================================== - Coverage 96.03% 95.95% -0.09% ========================================== Files 40 40 Lines 1892 1904 +12 ========================================== + Hits 1817 1827 +10 - Misses 75 77 +2 ``` | [Flag](https://app.codecov.io/gh/sinonjs/sinon/pull/2544/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sinonjs) | Coverage Δ | | |---|---|---| | [unit](https://app.codecov.io/gh/sinonjs/sinon/pull/2544/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sinonjs) | `95.95% <85.71%> (-0.09%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sinonjs#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files Changed](https://app.codecov.io/gh/sinonjs/sinon/pull/2544?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sinonjs) | Coverage Δ | | |---|---|---| | [lib/sinon/util/core/default-config.js](https://app.codecov.io/gh/sinonjs/sinon/pull/2544?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sinonjs#diff-bGliL3Npbm9uL3V0aWwvY29yZS9kZWZhdWx0LWNvbmZpZy5qcw==) | `100.00% <ø> (ø)` | | | [lib/sinon/sandbox.js](https://app.codecov.io/gh/sinonjs/sinon/pull/2544?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sinonjs#diff-bGliL3Npbm9uL3NhbmRib3guanM=) | `97.34% <84.61%> (-0.79%)` | :arrow_down: | | [lib/sinon/default-behaviors.js](https://app.codecov.io/gh/sinonjs/sinon/pull/2544?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sinonjs#diff-bGliL3Npbm9uL2RlZmF1bHQtYmVoYXZpb3JzLmpz) | `100.00% <100.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

fatso83 commented 1 year ago

Just fix the Prettier thingie and this is good to merge :)

npm run prettier:write
peanutenthusiast commented 1 year ago

Done!

mroderick commented 1 year ago

Thank you for your contribution! 🥳

This has been published to the npm registry as part of sinon@16.0.0