Skip to content
← All rules
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.

assertionscoveragebehavior
TypeScript
test("adds", () => { add(2, 3); });
Finding

Disallow tests with no effective behavior verification.

Setup

Install the package, register its plugin factory, then enable the rule.

Install the package

pnpm add -D @scruple/tests

Register 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

Released under the MIT License.