Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_runner: support using --inspect with --test #44520

Merged
merged 15 commits into from
Sep 10, 2022
Prev Previous commit
Next Next commit
primordials
  • Loading branch information
MoLow committed Sep 9, 2022
commit b07d5742a8d082cefafa5677c218264d4ee03eb9
11 changes: 7 additions & 4 deletions lib/internal/test_runner/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ const {
ArrayPrototypeFilter,
ArrayPrototypeIncludes,
ArrayPrototypeJoin,
ArrayPrototypePop,
ArrayPrototypePush,
ArrayPrototypeSlice,
ArrayPrototypeSort,
ObjectAssign,
PromisePrototypeThen,
RegExpPrototypeSymbolSplit,
SafePromiseAll,
SafeSet,
StringPrototypeEndsWith,
} = primordials;

const { Buffer } = require('buffer');
Expand Down Expand Up @@ -120,12 +123,12 @@ function makeStderrCallback(callback) {
callback(data);
const newData = Buffer.concat([buffer, data]);
const str = newData.toString('utf8');
let lines = str.split(/\r?\n/);
if (str.endsWith('\n'))
let lines = RegExpPrototypeSymbolSplit(/\r?\n/, str);
if (StringPrototypeEndsWith(str, '\n'))
buffer = Buffer.alloc(0);
else
buffer = Buffer.from(lines.pop(), 'utf8');
lines = lines.join('\n');
buffer = Buffer.from(ArrayPrototypePop(lines), 'utf8');
lines = ArrayPrototypeJoin(lines, '\n');
if (isInspectorMessage(lines)) {
process.stderr.write(lines);
}
Expand Down