forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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: nodejs#11420
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
'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}`]); | ||
} |