-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
module: ignore resolution failures for inspect-brk
The resolution for the main entry point may fail when the resolution requires a preloaded module to be executed first (for example when adding new extensions to the resolution process). Silently skipping such failures allow us to defer the resolution as long as needed without having any adverse change (since the main entry point won't resolve anyway if it really can't be resolved at all). PR-URL: #30336 Reviewed-By: Guy Bedford <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
- Loading branch information
1 parent
3d4c24d
commit 69ec9be
Showing
4 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
// eslint-disable-next-line no-unused-vars | ||
const common = require('../common'); | ||
|
||
require.extensions['.ext'] = require.extensions['.js']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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', | ||
]); |