node/test/sequential/test-debugger-debug-brk.js
penDerGraft 261ae7f58a
test: replace fixturesDir with fixtures module
PR-URL: https://github.com/nodejs/node/pull/15919
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2017-10-09 02:13:16 -07:00

31 lines
855 B
JavaScript

'use strict';
const common = require('../common');
common.skipIfInspectorDisabled();
const fixtures = require('../common/fixtures');
const assert = require('assert');
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');