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: add inspect-brk option to cluster module #12503

Closed
wants to merge 4 commits into from
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions test/parallel/test-cluster-inspect-brk.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
'use strict';
const common = require('../common');

// 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.');
}