no-skip-without-return
July 2, 2026 Β· View on GitHub
π Disallow t.skip()/t.todo() without returning afterwards.
πΌπ« This rule is enabled in the β
recommended config. This rule is disabled in the βοΈ unopinionated config.
π‘ This rule is manually fixable by editor suggestions.
t.skip() and t.todo() mark the test as skipped or todo, but they do not stop execution β any code after them still runs. From the Node.js docs: the call "does not terminate execution of the test function." So assertions placed after a conditional t.skip() run even when the test was meant to be skipped, often failing or causing side effects.
This rule reports a t.skip()/t.todo() call that is followed by reachable code. The suggestion inserts a return after it. Where a test should always be skipped, prefer the {skip: true} / {todo: true} option instead, which never runs the test body.
Examples
import test from 'node:test';
// β
test('x', t => {
if (notReady) {
t.skip('dependency unavailable');
}
assert.ok(compute()); // runs even when skipped
});
// β
test('x', t => {
if (notReady) {
t.skip('dependency unavailable');
return;
}
assert.ok(compute());
});
// β
(always skipped β body never runs)
test('x', {skip: 'dependency unavailable'}, t => {
assert.ok(compute());
});