Skip to content

Commit e93deac

Browse files
fixup!: add xfail cases to all reporter tests
1 parent 33983b1 commit e93deac

File tree

8 files changed

+84
-34
lines changed

8 files changed

+84
-34
lines changed

test/fixtures/test-runner/output/dot_reporter.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,12 @@ require('../../../common');
33
const fixtures = require('../../../common/fixtures');
44
const spawn = require('node:child_process').spawn;
55

6-
spawn(process.execPath,
7-
['--no-warnings', '--test-reporter', 'dot', fixtures.path('test-runner/output/output.js')], { stdio: 'inherit' });
6+
spawn(
7+
process.execPath,
8+
[
9+
'--no-warnings',
10+
'--test-reporter', 'dot',
11+
fixtures.path('test-runner/output/output.js'),
12+
],
13+
{ stdio: 'inherit' },
14+
);

test/fixtures/test-runner/output/junit_reporter.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ require('../../../common');
33
const fixtures = require('../../../common/fixtures');
44
const spawn = require('node:child_process').spawn;
55

6-
spawn(process.execPath,
7-
[
8-
'--no-warnings', '--test-reporter', 'junit',
9-
fixtures.path('test-runner/output/output.js'),
10-
],
11-
{ stdio: 'inherit' });
6+
spawn(
7+
process.execPath,
8+
[
9+
'--no-warnings',
10+
'--test-reporter', 'junit',
11+
fixtures.path('test-runner/output/output.js'),
12+
],
13+
{ stdio: 'inherit' },
14+
);

test/fixtures/test-runner/output/lcov_reporter.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ require('../../../common');
33
const fixtures = require('../../../common/fixtures');
44
const spawn = require('node:child_process').spawn;
55

6-
spawn(process.execPath,
7-
[
8-
'--no-warnings',
9-
'--experimental-test-coverage',
10-
'--test-coverage-exclude=!test/**',
11-
'--test-reporter',
12-
'lcov',
13-
fixtures.path('test-runner/output/output.js'),
14-
],
15-
{ stdio: 'inherit' },
6+
spawn(
7+
process.execPath,
8+
[
9+
'--no-warnings',
10+
'--experimental-test-coverage',
11+
'--test-coverage-exclude=!test/**',
12+
'--test-reporter', 'lcov',
13+
fixtures.path('test-runner/output/output.js'),
14+
],
15+
{ stdio: 'inherit' },
1616
);

test/fixtures/test-runner/output/output.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,30 @@ const assert = require('node:assert');
55
const test = require('node:test');
66
const util = require('util');
77

8+
test.xfail('sync expect fail (method)', () => {
9+
throw new Error('should pass');
10+
});
11+
12+
test('sync expect fail (options)', { xfail: true }, () => {
13+
throw new Error('should pass');
14+
});
15+
16+
test.xfail('async expect fail (method)', async () => {
17+
throw new Error('should pass');
18+
});
19+
20+
test('async expect fail (options)', { xfail: true }, async () => {
21+
throw new Error('should pass');
22+
});
23+
24+
test.todo('sync todo with expect fail', { xfail: true }, () => {
25+
throw new Error('should not count as an expected failure');
26+
});
27+
28+
test.skip('sync skip expect fail', { xfail: true }, () => {
29+
throw new Error('should not fail');
30+
});
31+
832
test('sync pass todo', (t) => {
933
t.todo();
1034
});
116 KB
Binary file not shown.

test/fixtures/test-runner/output/output_cli.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ require('../../../common');
33
const fixtures = require('../../../common/fixtures');
44
const spawn = require('node:child_process').spawn;
55

6-
spawn(process.execPath,
7-
[
8-
'--no-warnings', '--test', '--test-reporter', 'tap',
9-
fixtures.path('test-runner/output/output.js'),
10-
fixtures.path('test-runner/output/single.js'),
11-
],
12-
{ stdio: 'inherit' });
6+
spawn(
7+
process.execPath,
8+
[
9+
'--no-warnings',
10+
'--test-reporter', 'tap',
11+
'--test',
12+
fixtures.path('test-runner/output/output.js'),
13+
fixtures.path('test-runner/output/single.js'),
14+
],
15+
{ stdio: 'inherit' },
16+
);

test/fixtures/test-runner/output/spec_reporter.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@ require('../../../common');
33
const fixtures = require('../../../common/fixtures');
44
const spawn = require('node:child_process').spawn;
55

6-
const child = spawn(process.execPath,
7-
['--no-warnings', '--test-reporter', 'spec', fixtures.path('test-runner/output/output.js')],
8-
{ stdio: 'pipe' });
6+
const child = spawn(
7+
process.execPath,
8+
[
9+
'--no-warnings',
10+
'--test-reporter', 'spec',
11+
fixtures.path('test-runner/output/output.js'),
12+
],
13+
{ stdio: 'pipe' },
14+
);
15+
916
// eslint-disable-next-line no-control-regex
1017
child.stdout.on('data', (d) => process.stdout.write(d.toString().replace(/[^\x00-\x7F]/g, '').replace(/\u001b\[\d+m/g, '')));
1118
child.stderr.pipe(process.stderr);

test/fixtures/test-runner/output/spec_reporter_cli.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,17 @@ require('../../../common');
33
const fixtures = require('../../../common/fixtures');
44
const spawn = require('node:child_process').spawn;
55

6-
const child = spawn(process.execPath,
7-
[
8-
'--no-warnings', '--test', '--test-reporter', 'spec',
9-
fixtures.path('test-runner/output/output.js'),
10-
],
11-
{ stdio: 'pipe' });
6+
const child = spawn(
7+
process.execPath,
8+
[
9+
'--no-warnings',
10+
'--test-reporter', 'spec',
11+
'--test',
12+
fixtures.path('test-runner/output/output.js'),
13+
],
14+
{ stdio: 'pipe' },
15+
);
16+
1217
// eslint-disable-next-line no-control-regex
1318
child.stdout.on('data', (d) => process.stdout.write(d.toString().replace(/[^\x00-\x7F]/g, '').replace(/\u001b\[\d+m/g, '')));
1419
child.stderr.pipe(process.stderr);

0 commit comments

Comments
 (0)