ava/use-test

February 8, 2026 · View on GitHub

📝 Require AVA to be imported as test.

💼 This rule is enabled in the ✅ recommended config.

Translations: Français

The convention is to import AVA and assign it to a variable named test. Most rules in eslint-plugin-ava are based on that assumption. In a TypeScript file (.ts, .tsx, .mts, or .cts) AVA can be assigned to a variable named anyTest in order to define the types of t.context (see Typing t.context). Type-only imports (import type ... from 'ava' and import {type ...} from 'ava') are not linted.

Examples

// ❌
import ava from 'ava';

// ✅
import test from 'ava';
// ✅
import anyTest from 'ava';
import type {TestFn} from 'ava';

const test = anyTest as TestFn<{foo: string}>;
// ✅
import anyTest, {type TestFn} from 'ava';

const test = anyTest as TestFn<{foo: string}>;