summaryrefslogtreecommitdiff
path: root/test/sequential/test-resolution-inspect-brk.js
blob: 2af32426c03f5742fbe7481cb4136ec5f4016cae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
'use strict';
const common = require('../common');
common.skipIfInspectorDisabled();

// A test to ensure that preload modules are given a chance to execute before
// resolving the main entry point with --inspect-brk active.

const assert = require('assert');
const cp = require('child_process');
const path = require('path');

function test(execArgv) {
  const child = cp.spawn(process.execPath, execArgv);

  child.stderr.once('data', common.mustCall(function() {
    child.kill('SIGTERM');
  }));

  child.on('exit', common.mustCall(function(code, signal) {
    assert.strictEqual(signal, 'SIGTERM');
  }));
}

test([
  '--require',
  path.join(__dirname, '../fixtures/test-resolution-inspect-brk-resolver.js'),
  '--inspect-brk',
  '../fixtures/test-resolution-inspect-resolver-main.ext',
]);