Note: we probably don't want to log errors when they are intended (and fill up logs/false positives).
it('oops', async () => {
mock.post('/api/user', () => {
throw new Error('oops');
});
try {
const user = await createUser({name: 'John'});
} catch (error) {
// no idea what the user did wrong in their mock
expect(error).toMatch('A user named "John" already exists.');
}
})
making it really hard to debug when devs didn't actually intend to throw an error.
I think its happening in https://github.com/jameslnewell/xhr-mock/blob/master/packages/xhr-mock/src/MockXMLHttpRequest.ts#L523
Note: we probably don't want to log errors when they are intended (and fill up logs/false positives).