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: enable test-debugger-pid #12770

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -8,10 +8,9 @@ let buffer = '';
// connect to debug agent
const interfacer = spawn(process.execPath, ['debug', '-p', '655555']);

console.error(process.execPath, 'debug', '-p', '655555');
interfacer.stdout.setEncoding('utf-8');
interfacer.stderr.setEncoding('utf-8');
const onData = function(data) {
const onData = (data) => {
data = (buffer + data).split('\n');
buffer = data.pop();
data.forEach(function(line) {
@@ -25,26 +24,29 @@ let lineCount = 0;
interfacer.on('line', function(line) {
let expected;
const pid = interfacer.pid;
if (common.isWindows) {
switch (++lineCount) {
case 1:
line = line.replace(/^(debug> *)+/, '');
const msg = 'There was an internal error in Node\'s debugger. ' +
'Please report this bug.';
expected = `(node:${pid}) ${msg}`;
break;
switch (++lineCount) {
case 1:
expected =
new RegExp(`^\\(node:${pid}\\) \\[DEP0068\\] DeprecationWarning: `);
assert.ok(expected.test(line), `expected regexp match for ${line}`);
break;
case 2:
// Doesn't currently work on Windows.
if (!common.isWindows) {
expected = "Target process: 655555 doesn't exist.";
assert.strictEqual(line, expected);
}
break;

default:
return;
}
} else {
line = line.replace(/^(debug> *)+/, '');
expected = `(node:${pid}) Target process: 655555 doesn't exist.`;
default:
if (!common.isWindows)
assert.fail(`unexpected line received: ${line}`);
}

assert.strictEqual(expected, line);
});

interfacer.on('exit', function(code, signal) {
assert.strictEqual(code, 1, `Got unexpected code: ${code}`);
if (!common.isWindows) {
assert.strictEqual(lineCount, 2);
}
});
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.