Skip to content

Latest commit

 

History

History
38 lines (27 loc) · 1.04 KB

use-t-well.md

File metadata and controls

38 lines (27 loc) · 1.04 KB

Prevent the incorrect use of t

Translations: Français

Prevent the use of unknown assertion methods and the access to members other than the assertion methods and .context, as well as some known misuses of t.

This rule is partly fixable. It will replace misspelled .falsey with .falsy.

Fail

import test from 'ava';

test('main', t => {
	t(value); // `t` is not a function
	t.depEqual(value, [2]); // Unknown assertion method `.depEqual`
	t.contxt.foo = 100; // Unknown member `.contxt`. Use `.context.contxt` instead
	t.foo = 1000; // Unknown member `.foo`. Use `.context.foo` instead
	t.deepEqual.is(value, value); // Can't chain assertion methods
	t.skip(); // Missing assertion method
	t.deepEqual.skip.skip(); // Too many chained uses of `.skip`
});

Pass

import test from 'ava';

test('main', t => {
	t.deepEqual(value, [2]);
	t.context.a = 100;
	require(`fixtures/${t.title}`);
	t.deepEqual.skip();
});