sinonjs / sinon

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

Make the --watch flag work again #2504

Closed fatso83 closed 1 year ago

fatso83 commented 1 year ago

Purpose (TL;DR) - mandatory

We currently cannot use the --watch flag to Mocha as we tamper with the Function protype and keep state in the assertion tests. This PR should fix that

How to verify - mandatory

  1. npx mocha --watch
  2. Touch some file to trigger re-run
  3. See all pass

Checklist for author

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (477064b) 95.99% compared to head (3b4e6d2) 95.99%.

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

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2504 +/- ## ======================================= Coverage 95.99% 95.99% ======================================= Files 40 40 Lines 1897 1898 +1 ======================================= + Hits 1821 1822 +1 Misses 76 76 ``` | Flag | Coverage Δ | | |---|---|---| | unit | `95.99% <100.00%> (+<0.01%)` | :arrow_up: | 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. | [Impacted Files](https://codecov.io/gh/sinonjs/sinon/pull/2504?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sinonjs) | Coverage Δ | | |---|---|---| | [lib/sinon/spy-formatters.js](https://codecov.io/gh/sinonjs/sinon/pull/2504?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sinonjs#diff-bGliL3Npbm9uL3NweS1mb3JtYXR0ZXJzLmpz) | `98.52% <100.00%> (+0.02%)` | :arrow_up: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sinonjs). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sinonjs)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.