mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
f72376d323
Currently this test will fail if node was configured --without-ssl. PR-URL: https://github.com/nodejs/node/pull/12882 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
54 lines
1.4 KiB
JavaScript
54 lines
1.4 KiB
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
common.skipIfInspectorDisabled();
|
|
const assert = require('assert');
|
|
const spawn = require('child_process').spawn;
|
|
|
|
let buffer = '';
|
|
|
|
// connect to debug agent
|
|
const interfacer = spawn(process.execPath, ['debug', '-p', '655555']);
|
|
|
|
interfacer.stdout.setEncoding('utf-8');
|
|
interfacer.stderr.setEncoding('utf-8');
|
|
const onData = (data) => {
|
|
data = (buffer + data).split('\n');
|
|
buffer = data.pop();
|
|
data.forEach(function(line) {
|
|
interfacer.emit('line', line);
|
|
});
|
|
};
|
|
interfacer.stdout.on('data', onData);
|
|
interfacer.stderr.on('data', onData);
|
|
|
|
let lineCount = 0;
|
|
interfacer.on('line', function(line) {
|
|
let expected;
|
|
const pid = interfacer.pid;
|
|
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:
|
|
if (!common.isWindows)
|
|
assert.fail(`unexpected line received: ${line}`);
|
|
}
|
|
});
|
|
|
|
interfacer.on('exit', function(code, signal) {
|
|
assert.strictEqual(code, 1, `Got unexpected code: ${code}`);
|
|
if (!common.isWindows) {
|
|
assert.strictEqual(lineCount, 2);
|
|
}
|
|
});
|