Skip to content
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

[new-rule] recommend toThrow matcher for testing against errors (via typechecking) #802

Open
G-Rath opened this issue Mar 27, 2021 · 0 comments

Comments

@G-Rath
Copy link
Collaborator

G-Rath commented Mar 27, 2021

The documentation for toEqual says this:

Note: .toEqual won't perform a deep equality check for two errors. Only the message property of an Error is considered for equality. It is recommended to use the .toThrow matcher for testing against errors.

We should be able to use the typescript-powered type checking to determine if an expect value is an instance of Error, and if so check if the matcher being used is .toThrow.

@G-Rath G-Rath changed the title recommend toThrow matcher for testing against errors (via typechecking) [new-rule] recommend toThrow matcher for testing against errors (via typechecking) Mar 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant