Skip to content

Commit 1140002

Browse files
committed
test: log more information in debugger tests
1 parent 6566307 commit 1140002

7 files changed

+20
-2
lines changed

lib/internal/debugger/inspect_client.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,17 @@ class Client extends EventEmitter {
193193
if (payloadBuffer === null || payloadBuffer.length === 0) break;
194194

195195
const payloadStr = payloadBuffer.toString();
196-
debuglog('< %s', payloadStr);
196+
if (payloadStr.startsWith('{"method":"Debugger.scriptParsed"')) {
197+
// Do not log Debugger.scriptParsed events because the payloads
198+
// can be huge.
199+
debuglog('< Debugger.scriptParsed ...');
200+
} else if (payloadStr.startsWith('{"method":"Debugger.paused"')) {
201+
// Do not log Debugger.paused events because the payloads
202+
// can be huge.
203+
debuglog('< Debugger.paused ...');
204+
} else {
205+
debuglog('< %s', payloadStr);
206+
}
197207
const lastChar = payloadStr[payloadStr.length - 1];
198208
if (payloadStr[0] !== '{' || lastChar !== '}') {
199209
throw new ERR_DEBUGGER_ERROR(`Payload does not look like JSON: ${payloadStr}`);

test/common/debugger.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ const BREAK_MESSAGE = new RegExp('(?:' + [
77
'exception', 'other', 'promiseRejection',
88
].join('|') + ') in', 'i');
99

10-
const TIMEOUT = common.platformTimeout(5000);
10+
let TIMEOUT = common.platformTimeout(5000);
11+
if (common.isWindows) {
12+
TIMEOUT = common.platformTimeout(15000);
13+
}
1114

1215
function isPreBreak(output) {
1316
return /Break on start/.test(output) && /1 \(function \(exports/.test(output);

test/sequential/test-debugger-breakpoint-exists.js

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ common.skipIfInspectorDisabled();
77
const fixtures = require('../common/fixtures');
88
const startCLI = require('../common/debugger');
99

10+
process.env.NODE_DEBUG = 'inspect';
1011
// Test for "Breakpoint at specified location already exists" error.
1112
{
1213
const script = fixtures.path('debugger', 'three-lines.js');

test/sequential/test-debugger-help.js

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const fixtures = require('../common/fixtures');
77
const startCLI = require('../common/debugger');
88

99
const assert = require('assert');
10+
process.env.NODE_DEBUG = 'inspect';
1011

1112
{
1213
const cli = startCLI([fixtures.path('debugger/empty.js')]);

test/sequential/test-debugger-list.js

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const startCLI = require('../common/debugger');
88

99
const assert = require('assert');
1010

11+
process.env.NODE_DEBUG = 'inspect';
1112
const cli = startCLI([fixtures.path('debugger/three-lines.js')]);
1213

1314
(async () => {

test/sequential/test-debugger-low-level.js

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ common.skipIfInspectorDisabled();
66
const fixtures = require('../common/fixtures');
77
const startCLI = require('../common/debugger');
88
const assert = require('assert');
9+
process.env.NODE_DEBUG = 'inspect';
910

1011
// Debugger agent direct access.
1112
{

test/sequential/test-debugger-random-port.js

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const startCLI = require('../common/debugger');
88

99
const assert = require('assert');
1010

11+
process.env.NODE_DEBUG = 'inspect';
1112
// Random port.
1213
{
1314
const script = fixtures.path('debugger', 'three-lines.js');

0 commit comments

Comments
 (0)