Skip to content

Latest commit

 

History

History
41 lines (28 loc) · 1.16 KB

no-only-test.md

File metadata and controls

41 lines (28 loc) · 1.16 KB

Ensure no test.only() are present (ava/no-only-test)

💼 This rule is enabled in the ✅ recommended config.

🔧💡 This rule is automatically fixable by the --fix CLI option and manually fixable by editor suggestions.

Translations: Français

It's easy to run only one test with test.only() and then forget about it. It's visible in the results, but still easily missed. Forgetting to remove .only, means only this one test in the whole file will run, and if not caught, can let serious bugs slip into your codebase.

Fail

const test = require('ava');

test.only('test 1', t => {
	t.pass();
});

// test 2 will not run
test('test 2', t => {
	t.pass();
});

Pass

const test = require('ava');

test('test 1', t => {
	t.pass();
});

// test 2 will run
test('test 2', t => {
	t.pass();
});