1'use strict'; 2const common = require('../common'); 3common.skipIfInspectorDisabled(); 4 5// A test to ensure that preload modules are given a chance to execute before 6// resolving the main entry point with --inspect-brk active. 7 8const assert = require('assert'); 9const cp = require('child_process'); 10const path = require('path'); 11 12function test(execArgv) { 13 const child = cp.spawn(process.execPath, execArgv); 14 15 child.stderr.once('data', common.mustCall(function() { 16 child.kill('SIGTERM'); 17 })); 18 19 child.on('exit', common.mustCall(function(code, signal) { 20 assert.strictEqual(signal, 'SIGTERM'); 21 })); 22} 23 24test([ 25 '--require', 26 path.join(__dirname, '../fixtures/test-resolution-inspect-brk-resolver.js'), 27 '--inspect-brk', 28 '../fixtures/test-resolution-inspect-resolver-main.ext', 29]); 30