require-to-throw-message
Added in v0.7.3Configuration
rslint.config.ts
Rule Details
Require a message for toThrow() (and its alias toThrowError()).
toThrow() checks that a function throws, as in expect(() => a()).toThrow(). Without a message, the assertion passes for any thrown error. Requiring a message ensures the intended error is thrown.
This rule reports when toThrow() or toThrowError() is used with no argument. Negated forms such as .not.toThrow() without a message are allowed.
Examples of incorrect code for this rule:
Examples of correct code for this rule: