Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7b9710d

Browse filesBrowse files
dave-kMylesBorins
authored andcommitted
test: add inspect-brk option to cluster module
Ensure that cluster interoperates with the --inspect-brk option. This does not test for --debug-brk. Fixes: #11420 PR-URL: #12503 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent c9d440e commit 7b9710d
Copy full SHA for 7b9710d

File tree

Expand file treeCollapse file tree

1 file changed

+36
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+36
-0
lines changed
Open diff view settings
Collapse file
+36Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
'use strict';
2+
const common = require('../common');
3+
4+
// A test to ensure that cluster properly interoperates with the
5+
// --inspect-brk option.
6+
7+
const assert = require('assert');
8+
const cluster = require('cluster');
9+
const debuggerPort = common.PORT;
10+
11+
if (cluster.isMaster) {
12+
function test(execArgv) {
13+
14+
cluster.setupMaster({
15+
execArgv: execArgv,
16+
stdio: ['pipe', 'pipe', 'pipe', 'ipc', 'pipe']
17+
});
18+
19+
const worker = cluster.fork();
20+
21+
// Debugger listening on port [port].
22+
worker.process.stderr.once('data', common.mustCall(function() {
23+
worker.process.kill('SIGTERM');
24+
}));
25+
26+
worker.process.on('exit', common.mustCall(function(code, signal) {
27+
assert.strictEqual(signal, 'SIGTERM');
28+
}));
29+
}
30+
31+
test(['--inspect-brk']);
32+
test([`--inspect-brk=${debuggerPort}`]);
33+
} else {
34+
// Cluster worker is at a breakpoint, should not reach here.
35+
assert.fail('Test failed: cluster worker should be at a breakpoint.');
36+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.