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 591847c
Show file tree
Hide file tree
Showing 5 changed files with 578 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/internal/test_runner/reporter/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class SpecReporter extends Transform {
ArrayPrototypeShift(this.#reported);
hasChildren = true;
}
const skippedSubtest = subtest && data.skip && data.skip !== undefined;
const skippedSubtest = subtest && 'skip' in data;
const indent = this.#indent(data.nesting);
return `${this.#formatTestReport(type, data, prefix, indent, hasChildren, skippedSubtest)}\n`;
}
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 591847c

Please sign in to comment.