sinonjs / sinon

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

fix: make it possible to call through to underlying stub in stub instance #2503

Closed fatso83 closed 1 year ago

fatso83 commented 1 year ago

Purpose (TL;DR) - mandatory

A bug was introduced in #2477 that surfaced as #2501: it was impossible to call through to the underlying prototype's method when introducing no-ops. This fix moves the adding of no-ops to the restore phase, avoiding the issue.

How to verify - mandatory

Run the test suite 😄

Checklist for author

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.02 :tada:

Comparison is base (6e19746) 95.96% compared to head (c8e5b37) 95.99%.

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

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2503 +/- ## ========================================== + Coverage 95.96% 95.99% +0.02% ========================================== Files 38 40 +2 Lines 1883 1897 +14 ========================================== + Hits 1807 1821 +14 Misses 76 76 ``` | Flag | Coverage Δ | | |---|---|---| | unit | `95.99% <100.00%> (+0.02%)` | :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/2503?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sinonjs) | Coverage Δ | | |---|---|---| | [lib/sinon/create-stub-instance.js](https://codecov.io/gh/sinonjs/sinon/pull/2503?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sinonjs#diff-bGliL3Npbm9uL2NyZWF0ZS1zdHViLWluc3RhbmNlLmpz) | `100.00% <100.00%> (ø)` | | | [lib/sinon/sandbox.js](https://codecov.io/gh/sinonjs/sinon/pull/2503?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sinonjs#diff-bGliL3Npbm9uL3NhbmRib3guanM=) | `97.74% <100.00%> (+0.01%)` | :arrow_up: | | [lib/sinon/stub.js](https://codecov.io/gh/sinonjs/sinon/pull/2503?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sinonjs#diff-bGliL3Npbm9uL3N0dWIuanM=) | `95.19% <100.00%> (-0.54%)` | :arrow_down: | | [lib/sinon/util/core/sinon-type.js](https://codecov.io/gh/sinonjs/sinon/pull/2503?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sinonjs#diff-bGliL3Npbm9uL3V0aWwvY29yZS9zaW5vbi10eXBlLmpz) | `100.00% <100.00%> (ø)` | | | [lib/sinon/util/core/wrap-method.js](https://codecov.io/gh/sinonjs/sinon/pull/2503?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sinonjs#diff-bGliL3Npbm9uL3V0aWwvY29yZS93cmFwLW1ldGhvZC5qcw==) | `82.17% <100.00%> (+0.73%)` | :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.