mirror of
https://github.com/nodejs/node.git
synced 2024-11-29 23:16:30 +01:00
7205e0a0fe
Added comments to the tests to better describe what the test is doing. PR-URL: https://github.com/nodejs/node/pull/16003 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
35 lines
960 B
JavaScript
35 lines
960 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
common.skipIfInspectorDisabled();
|
|
|
|
// This test ensures that the debug-brk flag will spin up a new process and
|
|
// wait, rather than exit.
|
|
|
|
const assert = require('assert');
|
|
const fixtures = require('../common/fixtures');
|
|
const spawn = require('child_process').spawn;
|
|
|
|
// file name here doesn't actually matter since
|
|
// debugger will connect regardless of file name arg
|
|
const script = fixtures.path('empty.js');
|
|
|
|
function test(arg) {
|
|
const child = spawn(process.execPath, ['--inspect', arg, script]);
|
|
const argStr = child.spawnargs.join(' ');
|
|
const fail = () => assert.fail(true, false, `'${argStr}' should not quit`);
|
|
child.on('exit', fail);
|
|
|
|
// give node time to start up the debugger
|
|
setTimeout(function() {
|
|
child.removeListener('exit', fail);
|
|
child.kill();
|
|
}, 2000);
|
|
|
|
process.on('exit', function() {
|
|
assert(child.killed);
|
|
});
|
|
}
|
|
|
|
test('--debug-brk');
|
|
test('--debug-brk=5959');
|