require-assertions
Require every executable test to include at least one assertion.
Rule detailsโ
A test that only calls the subject can pass even when it proves no observable behavior. These tests often survive refactors because they exercise code paths without checking return values, thrown errors, emitted events, or state changes.
Incorrectโ
it("renders compact mode", () => {
renderWidget({ mode: "compact" });
});
Correctโ
it("renders compact mode", () => {
expect(renderWidget({ mode: "compact" }).mode).toBe("compact");
});
What this rule reportsโ
This rule reports executable it(...) and test(...) callbacks that do not
contain an expect(...) assertion. Skipped and todo tests are left to
no-disabled-tests.
Optionsโ
This rule has no options.
When not to use itโ
Disable this rule for integration suites where the test runner itself performs assertions outside the test body, such as generated contract tests with external golden-file validation.
Rule catalog ID: R008