Skip to content

Commit

Permalink
test_runner: fix spec skip detection
Browse files Browse the repository at this point in the history
PR-URL: #47537
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
  • Loading branch information
MoLow authored Apr 16, 2023
1 parent a777bbd commit 46a3cff
Show file tree
Hide file tree
Showing 5 changed files with 579 additions and 11 deletions.
4 changes: 2 additions & 2 deletions lib/internal/test_runner/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ class FileTest extends Test {
let directive;

if (skip) {
directive = this.reporter.getSkip(node.reason);
directive = this.reporter.getSkip(node.reason || true);
} else if (todo) {
directive = this.reporter.getTodo(node.reason);
directive = this.reporter.getTodo(node.reason || true);
} else {
directive = kEmptyObject;
}
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 46a3cff

Please sign in to comment.