Skip to content

Latest commit

 

History

History
36 lines (26 loc) · 630 Bytes

no-nested-tests.md

File metadata and controls

36 lines (26 loc) · 630 Bytes

Ensure no tests are nested

Translations: Français

In AVA, you cannot nest tests, for example, create tests inside of other tests. Doing so will lead to odd behavior.

Fail

const test = require('ava');

test('foo', t => {
	const result = foo();
	t.true(result.foo);

	test('bar', t => {
		t.true(result.bar);
	});
});

Pass

const test = require('ava');

test('foo', t => {
	const result = foo();
	t.true(result.foo);
});

test('bar', t => {
	const result = foo();
	t.true(result.bar);
});