forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-runner-run-files-undefined.mjs
More file actions
58 lines (50 loc) · 1.68 KB
/
test-runner-run-files-undefined.mjs
File metadata and controls
58 lines (50 loc) · 1.68 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import * as common from '../common/index.mjs';
import tmpdir from '../common/tmpdir.js';
import { describe, it, run, beforeEach } from 'node:test';
import { dot, spec, tap } from 'node:test/reporters';
import { fork } from 'node:child_process';
import assert from 'node:assert';
if (common.isAIX) {
common.skip('test runner without specifying files fails on AIX');
}
if (process.env.CHILD === 'true') {
describe('require(\'node:test\').run with no files', { concurrency: true }, () => {
beforeEach(() => {
tmpdir.refresh();
process.chdir(tmpdir.path);
});
it('should neither pass or fail', async () => {
const stream = run({
files: undefined
}).compose(tap);
stream.on('test:fail', common.mustNotCall());
stream.on('test:pass', common.mustNotCall());
// eslint-disable-next-line no-unused-vars
for await (const _ of stream);
});
it('can use the spec reporter', async () => {
const stream = run({
files: undefined
}).compose(spec);
stream.on('test:fail', common.mustNotCall());
stream.on('test:pass', common.mustNotCall());
// eslint-disable-next-line no-unused-vars
for await (const _ of stream);
});
it('can use the dot reporter', async () => {
const stream = run({
files: undefined
}).compose(dot);
stream.on('test:fail', common.mustNotCall());
stream.on('test:pass', common.mustNotCall());
// eslint-disable-next-line no-unused-vars
for await (const _ of stream);
});
});
} else {
fork(import.meta.filename, [], {
env: { CHILD: 'true' }
}).on('exit', common.mustCall((code) => {
assert.strictEqual(code, 0);
}));
}