sinonjs / sinon

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

docs: Remove threw(obj) from docs #2513

Closed mroderick closed 1 year ago

mroderick commented 1 year ago

Since the introduction of threw in 0feec9ffba0da6bc2996cefa0c6e71872e8bedb2, no one have reported that threw(obj) doesn't work as the documentation states.

const sinon = require("sinon");
const o = { pie: "apple" };
const f = sinon.fake.throws(o);

f();
// this is supposed to return true
f.threw(o);
// => false

Since it has been 12+ years without an error report, it's safe to assume that no one uses the threw method in this way. Let's remove it from the documentation.

mroderick commented 1 year ago

I'm not sure if this should have a version bump at all

codecov[bot] commented 1 year ago

Codecov Report

Patch and project coverage have no change.

Comparison is base (b2a4df5) 95.99% compared to head (5f7a468) 95.99%.

:exclamation: Current head 5f7a468 differs from pull request most recent head 832439d. Consider uploading reports for the commit 832439d to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2513 +/- ## ======================================= Coverage 95.99% 95.99% ======================================= Files 40 40 Lines 1899 1899 ======================================= Hits 1823 1823 Misses 76 76 ``` | Flag | Coverage Δ | | |---|---|---| | unit | `95.99% <ø> (ø)` | | 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.

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

fatso83 commented 1 year ago

Why not remove the threw prop at the same time and clean it up? Or fix it? Now it is just left as historic scraps

mroderick commented 1 year ago

Why not remove the threw prop at the same time and clean it up? Or fix it? Now it is just left as historic scraps

Using no argument spy.threw() or with a named error type spy.threw("TypeError"), threw works as documented.