11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../common');
31cb0ef41Sopenharmony_cicommon.skipIfInspectorDisabled();
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci// A test to ensure that preload modules are given a chance to execute before
61cb0ef41Sopenharmony_ci// resolving the main entry point with --inspect-brk active.
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ciconst assert = require('assert');
91cb0ef41Sopenharmony_ciconst cp = require('child_process');
101cb0ef41Sopenharmony_ciconst path = require('path');
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_cifunction test(execArgv) {
131cb0ef41Sopenharmony_ci  const child = cp.spawn(process.execPath, execArgv);
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_ci  child.stderr.once('data', common.mustCall(function() {
161cb0ef41Sopenharmony_ci    child.kill('SIGTERM');
171cb0ef41Sopenharmony_ci  }));
181cb0ef41Sopenharmony_ci
191cb0ef41Sopenharmony_ci  child.on('exit', common.mustCall(function(code, signal) {
201cb0ef41Sopenharmony_ci    assert.strictEqual(signal, 'SIGTERM');
211cb0ef41Sopenharmony_ci  }));
221cb0ef41Sopenharmony_ci}
231cb0ef41Sopenharmony_ci
241cb0ef41Sopenharmony_citest([
251cb0ef41Sopenharmony_ci  '--require',
261cb0ef41Sopenharmony_ci  path.join(__dirname, '../fixtures/test-resolution-inspect-brk-resolver.js'),
271cb0ef41Sopenharmony_ci  '--inspect-brk',
281cb0ef41Sopenharmony_ci  '../fixtures/test-resolution-inspect-resolver-main.ext',
291cb0ef41Sopenharmony_ci]);
30