Add more log points in the probe mode and enable the debuglog int the probe mode tests. Signed-off-by: Joyee Cheung <joyeec9h3@gmail.com> PR-URL: https://github.com/nodejs/node/pull/63663 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Kohei Ueno <kohei.ueno119@gmail.com>
76 lines
2.1 KiB
JavaScript
76 lines
2.1 KiB
JavaScript
// This tests debugger probe JSON output for duplicate and multi-probe hits.
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
common.skipIfInspectorDisabled();
|
|
|
|
const fixtures = require('../common/fixtures');
|
|
const { spawnSyncAndAssert } = require('../common/child_process');
|
|
const { assertProbeJson } = require('../common/debugger-probe');
|
|
|
|
const cwd = fixtures.path('debugger');
|
|
const probeUrl = fixtures.fileURL('debugger', 'probe.js').href;
|
|
const locationAt8 = { url: probeUrl, line: 8, column: 3 };
|
|
const locationAt12 = { url: probeUrl, line: 12, column: 1 };
|
|
|
|
spawnSyncAndAssert(process.execPath, [
|
|
'inspect',
|
|
'--json',
|
|
'--probe', 'probe.js:8',
|
|
'--expr', 'index',
|
|
'--probe', 'probe.js:8',
|
|
'--expr', 'total',
|
|
'--probe', 'probe.js:12',
|
|
'--expr', 'finalValue',
|
|
'probe.js',
|
|
], { cwd, env: { ...process.env, NODE_DEBUG: 'inspect_probe' } }, {
|
|
stdout(output) {
|
|
assertProbeJson(output, {
|
|
v: 2,
|
|
probes: [
|
|
{ expr: 'index', target: { suffix: 'probe.js', line: 8 } },
|
|
{ expr: 'total', target: { suffix: 'probe.js', line: 8 } },
|
|
{ expr: 'finalValue', target: { suffix: 'probe.js', line: 12 } },
|
|
],
|
|
results: [
|
|
{
|
|
probe: 0,
|
|
event: 'hit',
|
|
hit: 1,
|
|
location: locationAt8,
|
|
result: { type: 'number', value: 0, description: '0' },
|
|
},
|
|
{
|
|
probe: 1,
|
|
event: 'hit',
|
|
hit: 1,
|
|
location: locationAt8,
|
|
result: { type: 'number', value: 0, description: '0' },
|
|
},
|
|
{
|
|
probe: 0,
|
|
event: 'hit',
|
|
hit: 2,
|
|
location: locationAt8,
|
|
result: { type: 'number', value: 1, description: '1' },
|
|
},
|
|
{
|
|
probe: 1,
|
|
event: 'hit',
|
|
hit: 2,
|
|
location: locationAt8,
|
|
result: { type: 'number', value: 40, description: '40' },
|
|
},
|
|
{
|
|
probe: 2,
|
|
event: 'hit',
|
|
hit: 1,
|
|
location: locationAt12,
|
|
result: { type: 'number', value: 81, description: '81' },
|
|
},
|
|
{ event: 'completed' },
|
|
],
|
|
});
|
|
},
|
|
trim: true,
|
|
});
|