Skip to content

Commit 7dfa475

Browse files
cjihrignodejs-github-bot
authored andcommitted
test: add test for skip+todo combinations
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>
1 parent 312ebd9 commit 7dfa475

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
'use strict';
2+
const common = require('../common');
3+
const { strictEqual } = require('node:assert');
4+
const { run, suite, test } = require('node:test');
5+
6+
if (!process.env.NODE_TEST_CONTEXT) {
7+
const stream = run({ files: [__filename] });
8+
9+
stream.on('test:fail', common.mustNotCall());
10+
stream.on('test:pass', common.mustCall((event) => {
11+
strictEqual(event.skip, true);
12+
strictEqual(event.todo, undefined);
13+
}, 4));
14+
} else {
15+
test('test options only', { skip: true, todo: true }, common.mustNotCall());
16+
17+
test('test context calls only', common.mustCall((t) => {
18+
t.todo();
19+
t.skip();
20+
}));
21+
22+
test('todo test with context skip', { todo: true }, common.mustCall((t) => {
23+
t.skip();
24+
}));
25+
26+
// Note - there is no test for the skip option and t.todo() because the skip
27+
// option prevents the test from running at all. This is verified by other
28+
// tests.
29+
30+
// Suites don't have the context methods, so only test the options combination.
31+
suite('suite options only', { skip: true, todo: true }, common.mustNotCall());
32+
}

0 commit comments

Comments
 (0)