diff --git a/src/inspector/node_protocol.pdl b/src/inspector/node_protocol.pdl index 608521b467d9e4..d8a873de263f23 100644 --- a/src/inspector/node_protocol.pdl +++ b/src/inspector/node_protocol.pdl @@ -100,6 +100,12 @@ experimental domain NodeWorker # Support for inspecting node process state. experimental domain NodeRuntime + # Enable the NodeRuntime events except by `NodeRuntime.waitingForDisconnect`. + command enable + + # Disable NodeRuntime events + command disable + # Enable the `NodeRuntime.waitingForDisconnect`. command notifyWhenWaitingForDisconnect parameters @@ -110,3 +116,7 @@ experimental domain NodeRuntime # It is fired when the Node process finished all code execution and is # waiting for all frontends to disconnect. event waitingForDisconnect + + # This event is fired when the runtime is waiting for the debugger. For + # example, when inspector.waitingForDebugger is called + event waitingForDebugger diff --git a/src/inspector/runtime_agent.cc b/src/inspector/runtime_agent.cc index 037a77dbb9d044..94aa8bef405b66 100644 --- a/src/inspector/runtime_agent.cc +++ b/src/inspector/runtime_agent.cc @@ -8,7 +8,9 @@ namespace inspector { namespace protocol { RuntimeAgent::RuntimeAgent() - : notify_when_waiting_for_disconnect_(false) {} + : notify_when_waiting_for_disconnect_(false), + enabled_(false), + is_waiting_for_debugger_(false) {} void RuntimeAgent::Wire(UberDispatcher* dispatcher) { frontend_ = std::make_unique(dispatcher->channel()); @@ -20,6 +22,30 @@ DispatchResponse RuntimeAgent::notifyWhenWaitingForDisconnect(bool enabled) { return DispatchResponse::OK(); } +DispatchResponse RuntimeAgent::enable() { + enabled_ = true; + if (is_waiting_for_debugger_) { + frontend_->waitingForDebugger(); + } + return DispatchResponse::OK(); +} + +DispatchResponse RuntimeAgent::disable() { + enabled_ = false; + return DispatchResponse::OK(); +} + +void RuntimeAgent::setWaitingForDebugger() { + is_waiting_for_debugger_ = true; + if (enabled_) { + frontend_->waitingForDebugger(); + } +} + +void RuntimeAgent::unsetWaitingForDebugger() { + is_waiting_for_debugger_ = false; +} + bool RuntimeAgent::notifyWaitingForDisconnect() { if (notify_when_waiting_for_disconnect_) { frontend_->waitingForDisconnect(); diff --git a/src/inspector/runtime_agent.h b/src/inspector/runtime_agent.h index 4c249f8e82f625..f9ae909c2681c5 100644 --- a/src/inspector/runtime_agent.h +++ b/src/inspector/runtime_agent.h @@ -18,11 +18,21 @@ class RuntimeAgent : public NodeRuntime::Backend { DispatchResponse notifyWhenWaitingForDisconnect(bool enabled) override; + DispatchResponse enable() override; + + DispatchResponse disable() override; + bool notifyWaitingForDisconnect(); + void setWaitingForDebugger(); + + void unsetWaitingForDebugger(); + private: std::shared_ptr frontend_; bool notify_when_waiting_for_disconnect_; + bool enabled_; + bool is_waiting_for_debugger_; }; } // namespace protocol } // namespace inspector diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc index 31597de1e14083..63c8ae14abb3de 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc @@ -278,6 +278,10 @@ class ChannelImpl final : public v8_inspector::V8Inspector::Channel, return retaining_context_; } + void setWaitingForDebugger() { runtime_agent_->setWaitingForDebugger(); } + + void unsetWaitingForDebugger() { runtime_agent_->unsetWaitingForDebugger(); } + bool retainingContext() { return retaining_context_; } @@ -418,6 +422,9 @@ class NodeInspectorClient : public V8InspectorClient { void waitForFrontend() { waiting_for_frontend_ = true; + for (const auto& id_channel : channels_) { + id_channel.second->setWaitingForDebugger(); + } runMessageLoop(); } @@ -465,6 +472,9 @@ class NodeInspectorClient : public V8InspectorClient { void runIfWaitingForDebugger(int context_group_id) override { waiting_for_frontend_ = false; + for (const auto& id_channel : channels_) { + id_channel.second->unsetWaitingForDebugger(); + } } int connectFrontend(std::unique_ptr delegate, @@ -476,6 +486,9 @@ class NodeInspectorClient : public V8InspectorClient { std::move(delegate), getThreadHandle(), prevent_shutdown); + if (waiting_for_frontend_) { + channels_[session_id]->setWaitingForDebugger(); + } return session_id; } diff --git a/test/common/inspector-helper.js b/test/common/inspector-helper.js index 359f586344cb9e..2c4d4af6deb019 100644 --- a/test/common/inspector-helper.js +++ b/test/common/inspector-helper.js @@ -303,6 +303,9 @@ class InspectorSession { console.log('[test]', 'Verify node waits for the frontend to disconnect'); await this.send({ 'method': 'Debugger.resume' }); await this.waitForNotification((notification) => { + if (notification.method === 'Debugger.paused') { + this.send({ 'method': 'Debugger.resume' }); + } return notification.method === 'Runtime.executionContextDestroyed' && notification.params.executionContextId === 1; }); diff --git a/test/parallel/test-inspect-async-hook-setup-at-inspect.js b/test/parallel/test-inspect-async-hook-setup-at-inspect.js index 2c755582852a01..4b43fea96ab363 100644 --- a/test/parallel/test-inspect-async-hook-setup-at-inspect.js +++ b/test/parallel/test-inspect-async-hook-setup-at-inspect.js @@ -54,7 +54,6 @@ async function runTests() { 'params': { 'maxDepth': 10 } }, { 'method': 'Debugger.setBlackboxPatterns', 'params': { 'patterns': [] } }, - { 'method': 'Runtime.runIfWaitingForDebugger' }, ]); await waitForInitialSetup(session); diff --git a/test/parallel/test-inspector-async-hook-setup-at-inspect-brk.js b/test/parallel/test-inspector-async-hook-setup-at-inspect-brk.js index 04e36b589d2461..b5b45560bb2628 100644 --- a/test/parallel/test-inspector-async-hook-setup-at-inspect-brk.js +++ b/test/parallel/test-inspector-async-hook-setup-at-inspect-brk.js @@ -30,6 +30,8 @@ async function checkAsyncStackTrace(session) { async function runTests() { const instance = new NodeInstance(undefined, script); const session = await instance.connectInspectorSession(); + await session.send({ method: 'NodeRuntime.enable' }); + await session.waitForNotification('NodeRuntime.waitingForDebugger'); await session.send([ { 'method': 'Runtime.enable' }, { 'method': 'Debugger.enable' }, @@ -39,6 +41,7 @@ async function runTests() { 'params': { 'patterns': [] } }, { 'method': 'Runtime.runIfWaitingForDebugger' }, ]); + await session.send({ method: 'NodeRuntime.disable' }); await skipBreakpointAtStart(session); await checkAsyncStackTrace(session); diff --git a/test/parallel/test-inspector-async-hook-setup-at-signal.js b/test/parallel/test-inspector-async-hook-setup-at-signal.js index 1de7a3ed20acf6..43f50d00615723 100644 --- a/test/parallel/test-inspector-async-hook-setup-at-signal.js +++ b/test/parallel/test-inspector-async-hook-setup-at-signal.js @@ -69,7 +69,6 @@ async function runTests() { 'params': { 'maxDepth': 10 } }, { 'method': 'Debugger.setBlackboxPatterns', 'params': { 'patterns': [] } }, - { 'method': 'Runtime.runIfWaitingForDebugger' }, ]); await waitForInitialSetup(session); diff --git a/test/parallel/test-inspector-async-stack-traces-promise-then.js b/test/parallel/test-inspector-async-stack-traces-promise-then.js index f50d8994a24c95..1fdd71f0a8291d 100644 --- a/test/parallel/test-inspector-async-stack-traces-promise-then.js +++ b/test/parallel/test-inspector-async-stack-traces-promise-then.js @@ -20,6 +20,8 @@ function runTest() { async function runTests() { const instance = new NodeInstance(undefined, script); const session = await instance.connectInspectorSession(); + await session.send({ method: 'NodeRuntime.enable' }); + await session.waitForNotification('NodeRuntime.waitingForDebugger'); await session.send([ { 'method': 'Runtime.enable' }, { 'method': 'Debugger.enable' }, @@ -29,6 +31,7 @@ async function runTests() { 'params': { 'patterns': [] } }, { 'method': 'Runtime.runIfWaitingForDebugger' }, ]); + session.send({ method: 'NodeRuntime.disable' }); await session.waitForBreakOnLine(0, '[eval]'); await session.send({ 'method': 'Debugger.resume' }); diff --git a/test/parallel/test-inspector-async-stack-traces-set-interval.js b/test/parallel/test-inspector-async-stack-traces-set-interval.js index 35d2577b0c8f11..76f0a858cd9991 100644 --- a/test/parallel/test-inspector-async-stack-traces-set-interval.js +++ b/test/parallel/test-inspector-async-stack-traces-set-interval.js @@ -26,6 +26,8 @@ async function checkAsyncStackTrace(session) { async function runTests() { const instance = new NodeInstance(undefined, script); const session = await instance.connectInspectorSession(); + await session.send({ method: 'NodeRuntime.enable' }); + await session.waitForNotification('NodeRuntime.waitingForDebugger'); await session.send([ { 'method': 'Runtime.enable' }, { 'method': 'Debugger.enable' }, @@ -35,6 +37,7 @@ async function runTests() { 'params': { 'patterns': [] } }, { 'method': 'Runtime.runIfWaitingForDebugger' }, ]); + await session.send({ method: 'NodeRuntime.disable' }); await skipFirstBreakpoint(session); await checkAsyncStackTrace(session); diff --git a/test/parallel/test-inspector-break-e.js b/test/parallel/test-inspector-break-e.js index 274422cf59b190..ccbef313404140 100644 --- a/test/parallel/test-inspector-break-e.js +++ b/test/parallel/test-inspector-break-e.js @@ -8,11 +8,14 @@ const { NodeInstance } = require('../common/inspector-helper.js'); async function runTests() { const instance = new NodeInstance(undefined, 'console.log(10)'); const session = await instance.connectInspectorSession(); + await session.send({ method: 'NodeRuntime.enable' }); + await session.waitForNotification('NodeRuntime.waitingForDebugger'); await session.send([ { 'method': 'Runtime.enable' }, { 'method': 'Debugger.enable' }, { 'method': 'Runtime.runIfWaitingForDebugger' }, ]); + await session.send({ method: 'NodeRuntime.disable' }); await session.waitForBreakOnLine(0, '[eval]'); await session.runToCompletion(); assert.strictEqual((await instance.expectShutdown()).exitCode, 0); diff --git a/test/parallel/test-inspector-break-when-eval.js b/test/parallel/test-inspector-break-when-eval.js index bd9969e0dcfffd..d5170706a07153 100644 --- a/test/parallel/test-inspector-break-when-eval.js +++ b/test/parallel/test-inspector-break-when-eval.js @@ -20,7 +20,10 @@ async function setupDebugger(session) { 'params': { 'maxDepth': 0 } }, { 'method': 'Runtime.runIfWaitingForDebugger' }, ]; - session.send(commands); + await session.send({ method: 'NodeRuntime.enable' }); + await session.waitForNotification('NodeRuntime.waitingForDebugger'); + await session.send(commands); + await session.send({ method: 'NodeRuntime.disable' }); await session.waitForNotification('Debugger.paused', 'Initial pause'); diff --git a/test/parallel/test-inspector-console.js b/test/parallel/test-inspector-console.js index 33cd913efb2cec..659eccc17a71c7 100644 --- a/test/parallel/test-inspector-console.js +++ b/test/parallel/test-inspector-console.js @@ -20,7 +20,10 @@ async function runTest() { { 'method': 'Runtime.runIfWaitingForDebugger' }, ]; - session.send(commands); + await session.send({ method: 'NodeRuntime.enable' }); + await session.waitForNotification('NodeRuntime.waitingForDebugger'); + await session.send(commands); + await session.send({ method: 'NodeRuntime.disable' }); const msg = await session.waitForNotification('Runtime.consoleAPICalled'); diff --git a/test/parallel/test-inspector-debug-brk-flag.js b/test/parallel/test-inspector-debug-brk-flag.js index fd524b6918acd7..e417f54e93bf1f 100644 --- a/test/parallel/test-inspector-debug-brk-flag.js +++ b/test/parallel/test-inspector-debug-brk-flag.js @@ -22,7 +22,10 @@ async function testBreakpointOnStart(session) { { 'method': 'Runtime.runIfWaitingForDebugger' }, ]; - session.send(commands); + await session.send({ method: 'NodeRuntime.enable' }); + await session.waitForNotification('NodeRuntime.waitingForDebugger'); + await session.send(commands); + await session.send({ method: 'NodeRuntime.disable' }); await session.waitForBreakOnLine(0, session.scriptURL()); } diff --git a/test/parallel/test-inspector-debug-end.js b/test/parallel/test-inspector-debug-end.js index f3e343a0dadb25..bb63bceb150645 100644 --- a/test/parallel/test-inspector-debug-end.js +++ b/test/parallel/test-inspector-debug-end.js @@ -30,6 +30,8 @@ async function testSessionNoCrash() { const instance = new NodeInstance('--inspect-brk=0', script); const session = await instance.connectInspectorSession(); + await session.send({ method: 'NodeRuntime.enable' }); + await session.waitForNotification('NodeRuntime.waitingForDebugger'); await session.send({ 'method': 'Runtime.runIfWaitingForDebugger' }); await session.waitForServerDisconnect(); strictEqual((await instance.expectShutdown()).exitCode, 42); diff --git a/test/parallel/test-inspector-esm.js b/test/parallel/test-inspector-esm.js index 590432ad9ac31d..79025e80a76d9b 100644 --- a/test/parallel/test-inspector-esm.js +++ b/test/parallel/test-inspector-esm.js @@ -36,7 +36,10 @@ async function testBreakpointOnStart(session) { { 'method': 'Runtime.runIfWaitingForDebugger' }, ]; + await session.send({ method: 'NodeRuntime.enable' }); + await session.waitForNotification('NodeRuntime.waitingForDebugger'); await session.send(commands); + await session.send({ method: 'NodeRuntime.disable' }); await session.waitForBreakOnLine( 0, UrlResolve(session.scriptURL().toString(), 'message.mjs')); } diff --git a/test/parallel/test-inspector-exception.js b/test/parallel/test-inspector-exception.js index fc41de97e97841..fdfc6bab2989a7 100644 --- a/test/parallel/test-inspector-exception.js +++ b/test/parallel/test-inspector-exception.js @@ -28,7 +28,10 @@ async function testBreakpointOnStart(session) { { 'method': 'Runtime.runIfWaitingForDebugger' }, ]; + await session.send({ method: 'NodeRuntime.enable' }); + await session.waitForNotification('NodeRuntime.waitingForDebugger'); await session.send(commands); + await session.send({ method: 'NodeRuntime.disable' }); await session.waitForBreakOnLine(21, pathToFileURL(script).toString()); } diff --git a/test/parallel/test-inspector-inspect-brk-node.js b/test/parallel/test-inspector-inspect-brk-node.js index 04bac6dc7cf0df..d3bbd45b44ba19 100644 --- a/test/parallel/test-inspector-inspect-brk-node.js +++ b/test/parallel/test-inspector-inspect-brk-node.js @@ -10,9 +10,12 @@ const { NodeInstance } = require('../common/inspector-helper.js'); async function runTest() { const child = new NodeInstance(['--inspect-brk-node=0', '-p', '42']); const session = await child.connectInspectorSession(); + await session.send({ method: 'NodeRuntime.enable' }); + await session.waitForNotification('NodeRuntime.waitingForDebugger'); await session.send({ method: 'Runtime.enable' }); await session.send({ method: 'Debugger.enable' }); await session.send({ method: 'Runtime.runIfWaitingForDebugger' }); + await session.send({ method: 'NodeRuntime.disable' }); await session.waitForNotification((notification) => { // The main assertion here is that we do hit the loader script first. return notification.method === 'Debugger.scriptParsed' && diff --git a/test/parallel/test-inspector-multisession-ws.js b/test/parallel/test-inspector-multisession-ws.js index 1caae767ec55c3..6a2b1951d27e96 100644 --- a/test/parallel/test-inspector-multisession-ws.js +++ b/test/parallel/test-inspector-multisession-ws.js @@ -20,11 +20,12 @@ session.on('Debugger.paused', () => { session.connect(); session.post('Debugger.enable'); console.log('Ready'); -console.log('Ready'); `; async function setupSession(node) { const session = await node.connectInspectorSession(); + await session.send({ method: 'NodeRuntime.enable' }); + await session.waitForNotification('NodeRuntime.waitingForDebugger'); await session.send([ { 'method': 'Runtime.enable' }, { 'method': 'Debugger.enable' }, @@ -37,20 +38,19 @@ async function setupSession(node) { 'params': { 'interval': 100 } }, { 'method': 'Debugger.setBlackboxPatterns', 'params': { 'patterns': [] } }, - { 'method': 'Runtime.runIfWaitingForDebugger' }, ]); + return session; } async function testSuspend(sessionA, sessionB) { console.log('[test]', 'Breaking in code and verifying events are fired'); - await sessionA.waitForNotification('Debugger.paused', 'Initial pause'); + await Promise.all([ + sessionA.waitForNotification('Debugger.paused', 'Initial sessionA paused'), + sessionB.waitForNotification('Debugger.paused', 'Initial sessionB paused'), + ]); sessionA.send({ 'method': 'Debugger.resume' }); - await sessionA.waitForNotification('Runtime.consoleAPICalled', - 'Console output'); - // NOTE(mmarchini): Remove second console.log when - // https://bugs.chromium.org/p/v8/issues/detail?id=10287 is fixed. await sessionA.waitForNotification('Runtime.consoleAPICalled', 'Console output'); sessionA.send({ 'method': 'Debugger.pause' }); @@ -65,6 +65,14 @@ async function runTest() { const [session1, session2] = await Promise.all([setupSession(child), setupSession(child)]); + await Promise.all([ + session1.send({ method: 'Runtime.runIfWaitingForDebugger' }), + session2.send({ method: 'Runtime.runIfWaitingForDebugger' }), + ]); + await Promise.all([ + session1.send({ method: 'NodeRuntime.disable' }), + session2.send({ method: 'NodeRuntime.disable' }), + ]); await testSuspend(session2, session1); console.log('[test]', 'Should shut down after both sessions disconnect'); diff --git a/test/parallel/test-inspector-scriptparsed-context.js b/test/parallel/test-inspector-scriptparsed-context.js index 3c5c07a53a78c0..bd86ba53d4c986 100644 --- a/test/parallel/test-inspector-scriptparsed-context.js +++ b/test/parallel/test-inspector-scriptparsed-context.js @@ -46,10 +46,13 @@ async function runTests() { const instance = new NodeInstance(['--inspect-brk=0', '--expose-internals'], script); const session = await instance.connectInspectorSession(); - await session.send([ - { 'method': 'Debugger.enable' }, - { 'method': 'Runtime.runIfWaitingForDebugger' }, - ]); + + await session.send({ method: 'NodeRuntime.enable' }); + await session.waitForNotification('NodeRuntime.waitingForDebugger'); + await session.send({ 'method': 'Debugger.enable' }); + await session.send({ method: 'Runtime.runIfWaitingForDebugger' }); + await session.send({ method: 'NodeRuntime.disable' }); + await session.waitForBreakOnLine(2, '[eval]'); await session.send({ 'method': 'Runtime.enable' }); diff --git a/test/parallel/test-inspector-stop-profile-after-done.js b/test/parallel/test-inspector-stop-profile-after-done.js index f81884ecfd4e46..8378496753a68d 100644 --- a/test/parallel/test-inspector-stop-profile-after-done.js +++ b/test/parallel/test-inspector-stop-profile-after-done.js @@ -14,12 +14,15 @@ async function runTests() { }, ${common.platformTimeout(30)});`); const session = await child.connectInspectorSession(); - session.send([ + await session.send({ method: 'NodeRuntime.enable' }); + await session.waitForNotification('NodeRuntime.waitingForDebugger'); + await session.send([ { method: 'Profiler.setSamplingInterval', params: { interval: common.platformTimeout(300) } }, - { method: 'Profiler.enable' }, - { method: 'Runtime.runIfWaitingForDebugger' }, - { method: 'Profiler.start' }]); + { method: 'Profiler.enable' }]); + await session.send({ method: 'Runtime.runIfWaitingForDebugger' }); + await session.send({ method: 'NodeRuntime.disable' }); + await session.send({ method: 'Profiler.start' }); while (await child.nextStderrString() !== 'Waiting for the debugger to disconnect...'); await session.send({ method: 'Profiler.stop' }); diff --git a/test/parallel/test-inspector-wait-for-connection.js b/test/parallel/test-inspector-wait-for-connection.js index 0f562faede1e55..c28bebb1daa1eb 100644 --- a/test/parallel/test-inspector-wait-for-connection.js +++ b/test/parallel/test-inspector-wait-for-connection.js @@ -24,7 +24,11 @@ async function runTests() { } }); assert.ok(value.startsWith('ws://')); - session.send({ method: 'Runtime.runIfWaitingForDebugger' }); + await session.send({ method: 'NodeRuntime.enable' }); + child.write('first'); + await session.waitForNotification('NodeRuntime.waitingForDebugger'); + await session.send({ method: 'Runtime.runIfWaitingForDebugger' }); + await session.send({ method: 'NodeRuntime.disable' }); // Check that messages after first and before second waitForDebugger are // received await session.waitForConsoleOutput('log', 'after wait for debugger'); @@ -33,7 +37,11 @@ async function runTests() { .some((n) => n.method === 'Runtime.consoleAPICalled')); const secondSession = await child.connectInspectorSession(); // Check that inspector.waitForDebugger can be resumed from another session - secondSession.send({ method: 'Runtime.runIfWaitingForDebugger' }); + await session.send({ method: 'NodeRuntime.enable' }); + child.write('second'); + await session.waitForNotification('NodeRuntime.waitingForDebugger'); + await session.send({ method: 'Runtime.runIfWaitingForDebugger' }); + await session.send({ method: 'NodeRuntime.disable' }); await session.waitForConsoleOutput('log', 'after second wait for debugger'); assert.ok(!session.unprocessedNotifications() .some((n) => n.method === 'Runtime.consoleAPICalled')); @@ -45,11 +53,20 @@ async function runTests() { inspector.open(0, undefined, false); process._ws = inspector.url(); console.log('before wait for debugger'); - inspector.waitForDebugger(); - console.log('after wait for debugger'); - console.log('before second wait for debugger'); - inspector.waitForDebugger(); - console.log('after second wait for debugger'); + process.stdin.once('data', (data) => { + if (data.toString() === 'first') { + inspector.waitForDebugger(); + console.log('after wait for debugger'); + console.log('before second wait for debugger'); + process.stdin.once('data', (data) => { + if (data.toString() === 'second') { + inspector.waitForDebugger(); + console.log('after second wait for debugger'); + process.exit(); + } + }); + } + }); } // Check that inspector.waitForDebugger throws if there is no active diff --git a/test/parallel/test-inspector-waiting-for-disconnect.js b/test/parallel/test-inspector-waiting-for-disconnect.js index e9d39978d7aaf0..7c4ca7ec7cddce 100644 --- a/test/parallel/test-inspector-waiting-for-disconnect.js +++ b/test/parallel/test-inspector-waiting-for-disconnect.js @@ -17,11 +17,14 @@ async function runTest() { const oldStyleSession = await child.connectInspectorSession(); await oldStyleSession.send([ { method: 'Runtime.enable' }]); + await session.send({ method: 'NodeRuntime.enable' }); + await session.waitForNotification('NodeRuntime.waitingForDebugger'); await session.send([ { method: 'Runtime.enable' }, { method: 'NodeRuntime.notifyWhenWaitingForDisconnect', params: { enabled: true } }, { method: 'Runtime.runIfWaitingForDebugger' }]); + await session.send({ method: 'NodeRuntime.disable' }); await session.waitForNotification((notification) => { return notification.method === 'NodeRuntime.waitingForDisconnect'; }); diff --git a/test/parallel/test-inspector.js b/test/parallel/test-inspector.js index a62013ebb46896..769506a51c8514 100644 --- a/test/parallel/test-inspector.js +++ b/test/parallel/test-inspector.js @@ -75,7 +75,10 @@ async function testBreakpointOnStart(session) { { 'method': 'Runtime.runIfWaitingForDebugger' }, ]; + await session.send({ method: 'NodeRuntime.enable' }); + await session.waitForNotification('NodeRuntime.waitingForDebugger'); await session.send(commands); + await session.send({ method: 'NodeRuntime.disable' }); await session.waitForBreakOnLine(0, session.scriptURL()); } diff --git a/test/parallel/test-runner-inspect.mjs b/test/parallel/test-runner-inspect.mjs index 4cfc6bea54b964..e4e6a7d35f4810 100644 --- a/test/parallel/test-runner-inspect.mjs +++ b/test/parallel/test-runner-inspect.mjs @@ -24,9 +24,12 @@ tmpdir.refresh(); const session = await child.connectInspectorSession(); + await session.send({ method: 'NodeRuntime.enable' }); + await session.waitForNotification('NodeRuntime.waitingForDebugger'); await session.send([ { method: 'Runtime.enable' }, { method: 'Runtime.runIfWaitingForDebugger' }]); + await session.send({ method: 'NodeRuntime.disable' }); session.disconnect(); assert.match(stderr,