Skip to content

Commit

Permalink
test: add test for skip+todo combinations
Browse files Browse the repository at this point in the history
This commit adds a regression test for the edge case where a
test runner test is marked as both todo and skip.

Refs: #49013
PR-URL: #52204
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
  • Loading branch information
cjihrig authored and marco-ippolito committed May 2, 2024
1 parent 743ed30 commit 7fa136a
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/parallel/test-runner-todo-skip-tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'use strict';
const common = require('../common');
const { strictEqual } = require('node:assert');
const { run, suite, test } = require('node:test');

if (!process.env.NODE_TEST_CONTEXT) {
const stream = run({ files: [__filename] });

stream.on('test:fail', common.mustNotCall());
stream.on('test:pass', common.mustCall((event) => {
strictEqual(event.skip, true);
strictEqual(event.todo, undefined);
}, 4));
} else {
test('test options only', { skip: true, todo: true }, common.mustNotCall());

test('test context calls only', common.mustCall((t) => {
t.todo();
t.skip();
}));

test('todo test with context skip', { todo: true }, common.mustCall((t) => {
t.skip();
}));

// Note - there is no test for the skip option and t.todo() because the skip
// option prevents the test from running at all. This is verified by other
// tests.

// Suites don't have the context methods, so only test the options combination.
suite('suite options only', { skip: true, todo: true }, common.mustNotCall());
}

0 comments on commit 7fa136a

Please sign in to comment.