-
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.
inspector: introduce the
--inspect-wait
flag
PR-URL: #52734 Reviewed-By: Daeyeon Jeong <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Minwoo Jung <[email protected]>
- Loading branch information
1 parent
4102244
commit 8cb1312
Showing
7 changed files
with
90 additions
and
10 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
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
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
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
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
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
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,28 @@ | ||
import * as common from '../common/index.mjs'; | ||
|
||
common.skipIfInspectorDisabled(); | ||
|
||
import assert from 'node:assert'; | ||
import { NodeInstance } from '../common/inspector-helper.js'; | ||
|
||
|
||
async function runTests() { | ||
const child = new NodeInstance(['--inspect-wait=0'], 'console.log(0);'); | ||
const session = await child.connectInspectorSession(); | ||
await session.send({ method: 'NodeRuntime.enable' }); | ||
await session.waitForNotification('NodeRuntime.waitingForDebugger'); | ||
|
||
// The execution should be paused until the debugger is attached | ||
while (await child.nextStderrString() !== 'Debugger attached.'); | ||
|
||
await session.send({ 'method': 'Runtime.runIfWaitingForDebugger' }); | ||
|
||
// Wait for the execution to finish | ||
while (await child.nextStderrString() !== 'Waiting for the debugger to disconnect...'); | ||
|
||
await session.send({ method: 'NodeRuntime.disable' }); | ||
session.disconnect(); | ||
assert.strictEqual((await child.expectShutdown()).exitCode, 0); | ||
} | ||
|
||
runTests().then(common.mustCall()); |