mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
867 B
33 lines
867 B
10 years ago
|
'use strict';
|
||
9 years ago
|
const common = require('../common');
|
||
|
const assert = require('assert');
|
||
|
const spawn = require('child_process').spawn;
|
||
12 years ago
|
|
||
9 years ago
|
const PORT_MIN = common.PORT + 1; // The fixture uses common.PORT.
|
||
9 years ago
|
const PORT_MAX = PORT_MIN + 2;
|
||
12 years ago
|
|
||
9 years ago
|
const args = [
|
||
9 years ago
|
'--debug=' + PORT_MIN,
|
||
12 years ago
|
common.fixturesDir + '/clustered-server/app.js'
|
||
|
];
|
||
|
|
||
9 years ago
|
const child = spawn(process.execPath, args);
|
||
|
child.stderr.setEncoding('utf8');
|
||
12 years ago
|
|
||
9 years ago
|
const checkMessages = common.mustCall(() => {
|
||
|
for (let port = PORT_MIN; port <= PORT_MAX; port += 1) {
|
||
10 years ago
|
const re = RegExp(`Debugger listening on (\\[::\\]|0\\.0\\.0\\.0):${port}`);
|
||
|
assert(re.test(stderr));
|
||
9 years ago
|
}
|
||
|
});
|
||
|
|
||
9 years ago
|
let stderr = '';
|
||
9 years ago
|
child.stderr.on('data', (data) => {
|
||
9 years ago
|
process.stderr.write(`[DATA] ${data}`);
|
||
9 years ago
|
stderr += data;
|
||
9 years ago
|
if (child.killed !== true && stderr.includes('all workers are running')) {
|
||
9 years ago
|
child.kill();
|
||
9 years ago
|
checkMessages();
|
||
|
}
|
||
12 years ago
|
});
|