0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-28 22:46:31 +01:00
nodejs/test/sequential/test-cluster-inspect-brk.js
Daniel Bevenius 10ccf56f89 test: skipIfInspectorDisabled cluster-inspect-brk
When configured --without-ssl the inspect-brk option will not be
available and the process will exit with a exit value of 9 "Invalid
Argument/Bad option".

This commit adds a skipIfInspectorDisabled check since --without-ssl
implies that no inspector support is build as well.

PR-URL: https://github.com/nodejs/node/pull/12757
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-05-02 07:50:16 +02:00

38 lines
990 B
JavaScript

'use strict';
const common = require('../common');
common.skipIfInspectorDisabled();
// A test to ensure that cluster properly interoperates with the
// --inspect-brk option.
const assert = require('assert');
const cluster = require('cluster');
const debuggerPort = common.PORT;
if (cluster.isMaster) {
function test(execArgv) {
cluster.setupMaster({
execArgv: execArgv,
stdio: ['pipe', 'pipe', 'pipe', 'ipc', 'pipe']
});
const worker = cluster.fork();
// Debugger listening on port [port].
worker.process.stderr.once('data', common.mustCall(function() {
worker.process.kill('SIGTERM');
}));
worker.process.on('exit', common.mustCall(function(code, signal) {
assert.strictEqual(signal, 'SIGTERM');
}));
}
test(['--inspect-brk']);
test([`--inspect-brk=${debuggerPort}`]);
} else {
// Cluster worker is at a breakpoint, should not reach here.
assert.fail('Test failed: cluster worker should be at a breakpoint.');
}