-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rejects.toThrowError again #8140
Comments
@pedrottimark do you wanna unwrap this one and comment on the inconsistencies? |
As is, it's difficult to figure out exactly when The ideal API should have:
The return value of
|
For others who struggle with this issue for years, here is my workaround - https://github.com/DanielHreben/jest-matcher-specific-error |
@SimenB @pedrottimark any updates on this? |
I would love to be able to write such tests: expect(fn).toThrow().toMatchObject({code: 'ENOENT'}); |
Ava has a nice API that allows checking multiple properties of the error, in various ways: It would be nice to have something similar in jest. |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 14 days. |
IMO, this comment #8140 (comment) outlines a clean API that's still relevant. There's a question of versioning since it'll probably be a breaking change. EDIT removed an incorrect paragraph about confusing docs |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
💥 Regression Report
Related to #3601. I was reading .rejects and .toThrow docs and found inconsistent example imho. Google got me to #3601. Please could anyone help me to understand this issue if i misunderstood anything.
Last working version
Worked up to version: 20.0.3 I think
Stopped working in version: after #4884 i think
To Reproduce
Steps to reproduce the behavior:
sorry for broken code block. Couldn't fix
Expected behavior
As stated by @BetterCallSKY in #3601 in his 1st message before mergin PR #4884
Link to repl or repo (highly encouraged)
repl.it demo
Run
npx envinfo --preset jest
Paste the results here:
"jest": "^24.5.0"
The text was updated successfully, but these errors were encountered: