consistent-modifier-style

July 15, 2026 ยท View on GitHub

๐Ÿ“ Enforce a consistent style for test modifiers.

๐Ÿšซ This rule is disabled in the following configs: โœ… recommended, โ˜‘๏ธ unopinionated.

node:test lets you mark a test as only, skip, or todo two equivalent ways: a chained modifier (test.skip('โ€ฆ', fn)) or a property in the options object (test('โ€ฆ', {skip: true}, fn)). Mixing both styles in a codebase is inconsistent. This rule enforces one.

It is off by default. Enable it with the style you prefer.

Only {modifier: true} is reported under the chained style, since a reason string ({skip: 'why'}), an explicit false, or a dynamic value has no equivalent chained form.

Hooks (before, after, beforeEach, afterEach) are always ignored, since they have no chained modifier form in node:test.

Options

  • style ('chained' | 'options', default 'chained') โ€” which form to require.
{
	'node-test/consistent-modifier-style': [
		'error',
		{
			style: 'chained'
		}
	]
}

Examples

With the default {style: 'chained'}:

import test from 'node:test';

// โŒ
test('t', {skip: true}, () => {});

// โœ…
test.skip('t', () => {});

With {style: 'options'}:

import test from 'node:test';

// โŒ
test.skip('t', () => {});

// โœ…
test('t', {skip: true}, () => {});