-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Closed as not planned
Description
Version
29.7.0
Steps to reproduce
it('should check error cause', () => {
const fn = () => {
throw new Error('error message', { cause: { code: '1234' } });
};
expect(fn).toThrow({
name: 'Error',
message: 'error message',
cause: { code: 'random string' },
});
});
Expected behavior
I expect the test above to fail, as the two causes are different.
The error message is being checked, but not the cause.
Actual behavior
The test pass independently from the cause field.
Additional context
No response
Environment
System:
OS: macOS 14.4.1
CPU: (10) arm64 Apple M1 Pro
Binaries:
Node: 20.12.2 - /usr/local/bin/node
npm: 10.5.0 - /usr/local/bin/npm
npmPackages:
jest: 29.7.0 => 29.7.0Reactions are currently unavailable