TestsTest effectiveness
tests/require-specific-error-assertions
Throw and rejection assertions should check a stable class, code, message contract, or equivalent discriminator unless any failure is intentionally acceptable.
01 Examples
TypeScript
await expect(load("missing")).rejects.toThrow();Finding
Require assertions that identify the expected failure.
02 Enable it
Setup
Install the package, register its plugin factory, then enable the rule.
Install the package
pnpm add -D @scruple/testsRegister the plugin
In scruple.config.ts, register the factory under the tests namespace used by the rule ID.
import { tests } from "@scruple/tests";
plugins: {
"tests": tests(),
},Enable the rule
"tests/require-specific-error-assertions": "warn"- Package
@scruple/tests- Default threshold
- Plugin default
- Minimum confidence
- Plugin default