ava/prefer-power-assert

February 8, 2026 · View on GitHub

📝 Enforce using only assertions compatible with power-assert.

🚫 This rule is disabled in the ✅ recommended config.

Translations: Français

Useful for people wanting to fully embrace the power of power-assert.

Examples

import test from 'ava';

test('foo', t => {
	// ❌
	t.truthy(foo);
	t.falsy(foo);
	t.true(foo === bar);
	t.false(foo === bar);
	t.is(foo, bar);
	t.not(foo, bar);
	t.regex(foo, bar);
	t.ifError(error);

	// ✅
	t.assert(foo === bar);
	t.deepEqual(foo, bar);
	t.notDeepEqual(foo, bar);
	t.throws(foo);
	t.notThrows(bar);
});