Version
29.4.1
Steps to reproduce
- Clone my repo at https://github.com/BalassaMarton/jest-matcher-test-repro
yarn install
yarn test
The project contains a custom matcher, and a test that tests this custom matcher:
expect(() => {
expect("1").toBeNumber();
}).toThrow(JestAssertionError);
Expected behavior
All tests should pass
Actual behavior
Test fails (crashes) with below output:
expect(received).toThrow(expected)
Expected constructor: JestAssertionError
Received constructor: JestAssertionError
Received message: "Expected received to be a number but found 1."
[call stack and other info trimmed]
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 passed, 2 total
Snapshots: 0 total
Time: 2.015 s, estimated 3 s
Ran all test suites.
Additional context
No response
Environment
System:
OS: Windows 10 10.0.19045
CPU: (8) x64 Intel(R) Core(TM) i7-4810MQ CPU @ 2.80GHz
Binaries:
Node: 19.5.0 - C:\Program Files\nodejs\node.EXE
Yarn: 3.4.1 - C:\Program Files\nodejs\yarn.CMD
npm: 9.3.1 - C:\Program Files\nodejs\npm.CMD
Version
29.4.1
Steps to reproduce
yarn installyarn testThe project contains a custom matcher, and a test that tests this custom matcher:
Expected behavior
All tests should pass
Actual behavior
Test fails (crashes) with below output:
Additional context
No response
Environment
System: OS: Windows 10 10.0.19045 CPU: (8) x64 Intel(R) Core(TM) i7-4810MQ CPU @ 2.80GHz Binaries: Node: 19.5.0 - C:\Program Files\nodejs\node.EXE Yarn: 3.4.1 - C:\Program Files\nodejs\yarn.CMD npm: 9.3.1 - C:\Program Files\nodejs\npm.CMD