Skip to content

Latest commit

Β 

History

History
32 lines (22 loc) Β· 658 Bytes

File metadata and controls

32 lines (22 loc) Β· 658 Bytes

ava/no-duplicate-hooks

πŸ“ Disallow duplicate hook declarations.

πŸ’Ό This rule is enabled in the βœ… recommended config.

Disallow multiple hooks of the same type in a test file.

Registering the same hook type multiple times is usually a copy-paste mistake. Both hooks will run, which is confusing and error-prone. Combine the logic into a single hook instead.

Examples

import test from 'ava';

// ❌
test.before(t => {
	// setup A
});

test.before(t => {
	// setup B
});

// βœ…
test.before(t => {
	// setup A
	// setup B
});