Back to Sinon

spyCall.threw

docs/concepts/spy-call/api/threw.md

22.1.0488 B
Original Source

spyCall.threw();

Returns true, when the spied function threw on this call.

<<< ../../../.vitepress/tests/docs/spy-call/api/threw-1.test.js

spyCall.threw("TypeError");

Returns true, when the spied function threw provided type on this call.

<<< ../../../.vitepress/tests/docs/spy-call/api/threw-2.test.js

spyCall.threw(obj);

Returns true, when the spied function threw provided object on this call.

<<< ../../../.vitepress/tests/docs/spy-call/api/threw-3.test.js