Skip to content

Commit

Permalink
test_runner: fix spec skip detection
Browse files Browse the repository at this point in the history
  • Loading branch information
MoLow committed Apr 13, 2023
1 parent 57508fb commit e7e9868
Show file tree
Hide file tree
Showing 7 changed files with 585 additions and 20 deletions.
9 changes: 3 additions & 6 deletions lib/internal/test_runner/tap_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -753,12 +753,9 @@ class TapParser extends Transform {
}
}

const reason = StringPrototypeTrim(this.#readNextLiterals());
if (todoOrSkipToken) {
if (reason) {
test.reason = reason;
}

if (todoOrSkipToken === 'todo' || todoOrSkipToken === 'skip') {
const reason = StringPrototypeTrim(this.#readNextLiterals());
test.reason = reason || true;
test.status.todo = todoOrSkipToken === 'todo';
test.status.skip = todoOrSkipToken === 'skip';
}
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/test-runner/output/spec_reporter.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
test with a name and options provided (*ms) # SKIP
functionAndOptions (*ms) # SKIP
escaped description \ # \#\
 (*ms)
 (*ms)
escaped skip message (*ms) # SKIP
escaped todo message (*ms)
escaped diagnostic (*ms)
Expand Down
12 changes: 12 additions & 0 deletions test/fixtures/test-runner/output/spec_reporter_cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Flags: --no-warnings
'use strict';
require('../../../common');
const fixtures = require('../../../common/fixtures');
const spawn = require('node:child_process').spawn;

const child = spawn(process.execPath,
['--no-warnings', '--test', '--test-reporter', 'spec', fixtures.path('test-runner/output/output.js')],
{ stdio: 'pipe' });
// eslint-disable-next-line no-control-regex
child.stdout.on('data', (d) => process.stdout.write(d.toString().replace(/[^\x00-\x7F]/g, '').replace(/\u001b\[\d+m/g, '')));
child.stderr.pipe(process.stderr);
Loading

0 comments on commit e7e9868

Please sign in to comment.