Use for this testing pattern:
try { call() assert.fail("this should never happen"); } catch (e) { ... } Just do this try { shouldThrowSync(call); // If this succeeds unexpectedResultError is thrown. } catch(e) { ... } Copy
try { call() assert.fail("this should never happen"); } catch (e) { ... } Just do this try { shouldThrowSync(call); // If this succeeds unexpectedResultError is thrown. } catch(e) { ... }
The function that is expected to throw.
Optional
Use for this testing pattern: