Const
Assertion for testing if a function throws an error of a specific type.
expect( () => { throw new TypeError('wrong type'); }, 'to throw a', TypeError,); // passesexpect( () => { throw new Error('oops'); }, 'to throw an', TypeError,); // fails Copy
expect( () => { throw new TypeError('wrong type'); }, 'to throw a', TypeError,); // passesexpect( () => { throw new Error('oops'); }, 'to throw an', TypeError,); // fails
Assertion for testing if a function throws an error of a specific type.