ava/require-assertion
February 10, 2026 ยท View on GitHub
๐ Require that tests contain at least one assertion.
๐ผ This rule is enabled in the โ
recommended config.
Require that tests contain at least one assertion.
A test without assertions always passes, which usually indicates a mistake such as a forgotten assertion or an incomplete test.
Any of AVA's assertion methods count: t.is(), t.true(), t.pass(), t.plan(), t.snapshot(), t.throws(), t.try(), etc. Passing t to a helper function also counts, as assertions may happen there.
Hooks (test.before, test.beforeEach, test.after, test.afterEach) and test.todo() are not required to contain assertions.
Examples
import test from 'ava';
// โ
test('main', t => {
doSomething();
});
// โ
test('main', t => {
t.log('debug');
});
// โ
test('main', t => {
const result = doSomething();
t.is(result, expected);
});
// โ
test('main', t => {
t.pass();
});