You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
consta=sinon.spy(()=>{throwundefined;});try{a();}catch(e){// 1. this won't be loggedconsole.log('Error has being thrown');}// 2. This will throw// Uncaught AssertError: spy did not throw exceptionsinon.assert.threw(a);
Expected behavior
throw the thrown error
the assertion should pass
As said in the docs about the 2nd thing:
sinon.assert.threw(spyOrSpyCall, exception);
Passes if spy threw the given exception.
The exception can be a String denoting its type, or an actual object.
If only one argument is provided, the assertion passes if spy ever threw any exception.
Context (please complete the following information):
Library version: 14.0.0
Environment: node
The text was updated successfully, but these errors were encountered:
rluvaton
changed the title
sinon not throwing the error that been thrown when the error is undefined and fail to assert
sinon not throwing the error that been thrown when the error is undefined and also fail to assert
Sep 11, 2022
Describe the bug
If the function throw
undefined
then:sinon.assert.threw(a);
failTo Reproduce
ReplIt Link
Expected behavior
As said in the docs about the 2nd thing:
Context (please complete the following information):
The text was updated successfully, but these errors were encountered: