Closed as not planned
Description
Page(s)
https://jestjs.io/docs/expect#tothrowerror
Description
When attempting to use the toThrow()
method to validate an exact error message, I expected the following code to pass, according to the docs.
expect((async () => { throw new Error('message', { cause: new Error('cause') }); })()).rejects.toThrow(new Error('message'))
However, it fails with error
expect(received).rejects.toThrow(expected)
- Expected message - 1
+ Received message and cause + 8
That's reasonable behavior, but it should be documented as such.