forked from nodejs/node
/
test-runner-todo-skip-tests.js
32 lines (26 loc) · 1.02 KB
/
test-runner-todo-skip-tests.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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());
}