test: enable test-debugger-pid
Now that `node debug` is an alias for `node inspect`, it's possible that `node-debug-pid` can run reliably. Modify for current behavior and move from `disabled` to `parallel`. PR-URL: https://github.com/nodejs/node/pull/12770 Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Refael Ackermann <refack@gmail.com>
This commit is contained in:
parent
ff001c12b0
commit
4677766d21
@ -8,10 +8,9 @@ let buffer = '';
|
|||||||
// connect to debug agent
|
// connect to debug agent
|
||||||
const interfacer = spawn(process.execPath, ['debug', '-p', '655555']);
|
const interfacer = spawn(process.execPath, ['debug', '-p', '655555']);
|
||||||
|
|
||||||
console.error(process.execPath, 'debug', '-p', '655555');
|
|
||||||
interfacer.stdout.setEncoding('utf-8');
|
interfacer.stdout.setEncoding('utf-8');
|
||||||
interfacer.stderr.setEncoding('utf-8');
|
interfacer.stderr.setEncoding('utf-8');
|
||||||
const onData = function(data) {
|
const onData = (data) => {
|
||||||
data = (buffer + data).split('\n');
|
data = (buffer + data).split('\n');
|
||||||
buffer = data.pop();
|
buffer = data.pop();
|
||||||
data.forEach(function(line) {
|
data.forEach(function(line) {
|
||||||
@ -25,26 +24,29 @@ let lineCount = 0;
|
|||||||
interfacer.on('line', function(line) {
|
interfacer.on('line', function(line) {
|
||||||
let expected;
|
let expected;
|
||||||
const pid = interfacer.pid;
|
const pid = interfacer.pid;
|
||||||
if (common.isWindows) {
|
switch (++lineCount) {
|
||||||
switch (++lineCount) {
|
case 1:
|
||||||
case 1:
|
expected =
|
||||||
line = line.replace(/^(debug> *)+/, '');
|
new RegExp(`^\\(node:${pid}\\) \\[DEP0068\\] DeprecationWarning: `);
|
||||||
const msg = 'There was an internal error in Node\'s debugger. ' +
|
assert.ok(expected.test(line), `expected regexp match for ${line}`);
|
||||||
'Please report this bug.';
|
break;
|
||||||
expected = `(node:${pid}) ${msg}`;
|
case 2:
|
||||||
break;
|
// Doesn't currently work on Windows.
|
||||||
|
if (!common.isWindows) {
|
||||||
|
expected = "Target process: 655555 doesn't exist.";
|
||||||
|
assert.strictEqual(line, expected);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return;
|
if (!common.isWindows)
|
||||||
}
|
assert.fail(`unexpected line received: ${line}`);
|
||||||
} else {
|
|
||||||
line = line.replace(/^(debug> *)+/, '');
|
|
||||||
expected = `(node:${pid}) Target process: 655555 doesn't exist.`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.strictEqual(expected, line);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
interfacer.on('exit', function(code, signal) {
|
interfacer.on('exit', function(code, signal) {
|
||||||
assert.strictEqual(code, 1, `Got unexpected code: ${code}`);
|
assert.strictEqual(code, 1, `Got unexpected code: ${code}`);
|
||||||
|
if (!common.isWindows) {
|
||||||
|
assert.strictEqual(lineCount, 2);
|
||||||
|
}
|
||||||
});
|
});
|
Loading…
x
Reference in New Issue
Block a user