From 5f3ee114295937f3eff3ac01c453d53f7e0d7344 Mon Sep 17 00:00:00 2001 From: cola119 Date: Sun, 27 Mar 2022 08:05:51 +0900 Subject: [PATCH] src: fix syntax error not showing in stderr with node --inspect-brk --- src/inspector_agent.cc | 1 - ...test-inspector-inspect-brk-error-report.js | 30 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 test/parallel/test-inspector-inspect-brk-error-report.js diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc index 5fc533741d7c8d..07e30fe9b06417 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc @@ -821,7 +821,6 @@ void Agent::ReportUncaughtException(Local error, if (!IsListening()) return; client_->ReportUncaughtException(error, message); - WaitForDisconnect(); } void Agent::PauseOnNextJavascriptStatement(const std::string& reason) { diff --git a/test/parallel/test-inspector-inspect-brk-error-report.js b/test/parallel/test-inspector-inspect-brk-error-report.js new file mode 100644 index 00000000000000..8fa5aa5de50cb8 --- /dev/null +++ b/test/parallel/test-inspector-inspect-brk-error-report.js @@ -0,0 +1,30 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); + +common.skipIfInspectorDisabled(); + +const { NodeInstance } = require('../common/inspector-helper.js'); + +async function runTest() { + const child = new NodeInstance(['--inspect-brk'], 'console.log(1'); + const session = await child.connectInspectorSession(); + await session.send({ method: 'Runtime.enable' }); + await session.send({ method: 'Debugger.enable' }); + await session.send({ method: 'Runtime.runIfWaitingForDebugger' }); + let match = false; + while (true) { + const stderr = await child.nextStderrString(); + if (/SyntaxError: missing \) after argument list/.test(stderr)) { + match = true; + } + if (/Waiting for the debugger to disconnect/.test(stderr)) { + break; + } + } + assert.ok(match); + await session.disconnect(); + return child.expectShutdown(); +} + +runTest().then(common.mustCall());