import assert from 'assert';
const fn = () => { throw new Error('bar') }
describe('fn()', () => {
it('should throw "foo"', () => {
assert.throws(fn, Error, 'foo');
});
});
It (incorrectly) says the test passed:
fn()
√ should throw "foo"
1 passing (8ms)
This is wrong because fn() throws 'bar' not 'foo'. What am I doing wrong?