Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 973 Bytes

use-test.md

File metadata and controls

33 lines (24 loc) · 973 Bytes

Ensure that AVA is imported with test as the variable name

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 or .tsx) AVA can be assigned to a variable named anyTest in order to define the types of t.context (see Typing t.context).

Fail

var ava = require('ava');
let ava = require('ava');
const ava = require('ava');
import ava from 'ava';

Pass

var test = require('ava');
let test = require('ava');
const test = require('ava');
import test from 'ava';

var test = require('foo');
const test = require('foo');
import anyTest from 'ava';

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