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();
});