TestsTest effectiveness
tests/no-vacuous-tests
Tests should causally verify claimed behavior with assertions, snapshots, expected failures, or mock interactions rather than merely executing code or asserting tautologies.
01 Examples
TypeScript
test("adds", () => { add(2, 3); });Finding
Disallow tests with no effective behavior verification.
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/no-vacuous-tests": "warn"- Package
@scruple/tests- Default threshold
- 0.9
- Minimum confidence
- 0.7