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}, () => {});