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