Constawait expectAsync(
() => Promise.reject(new Error('oops')),
'to reject with error satisfying',
'oops',
); // passes
await expectAsync(
() => Promise.reject(new Error('fail')),
'to reject with error satisfying',
/error/i,
); // passes
await expectAsync(
() => Promise.reject(new Error('oops')),
'to reject with error satisfying',
{ message: 'oops' },
); // passes
Assertion for testing if a function rejects with an error satisfying specific criteria.