mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 18:25:13 +08:00
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>
51 lines
1.5 KiB
JavaScript
51 lines
1.5 KiB
JavaScript
// This tests that a clean process.exit(0) from inside a probe expression
|
|
// surfaces as probe_failure, not probe_target_exit.
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
common.skipIfInspectorDisabled();
|
|
|
|
const fixtures = require('../common/fixtures');
|
|
const { spawnSyncAndExit } = require('../common/child_process');
|
|
const { assertProbeJson } = require('../common/debugger-probe');
|
|
|
|
const cwd = fixtures.path('debugger');
|
|
const fixture = 'probe-exits-during-probe.js';
|
|
const probes = [{ expr: 'exitDuringProbe()', target: { suffix: fixture, line: 8 } }];
|
|
const location = { url: fixtures.fileURL('debugger', fixture).href, line: 8, column: 1 };
|
|
|
|
spawnSyncAndExit(process.execPath, [
|
|
'inspect', '--json',
|
|
'--probe', `${fixture}:8`, '--expr', probes[0].expr,
|
|
fixture,
|
|
], { cwd, env: { ...process.env, NODE_DEBUG: 'inspect_probe' } }, {
|
|
status: 1,
|
|
signal: null,
|
|
stdout(output) {
|
|
assertProbeJson(output, {
|
|
v: 2,
|
|
probes,
|
|
results: [{
|
|
probe: 0,
|
|
event: 'hit',
|
|
hit: 1,
|
|
location,
|
|
error: { message: 'Probe evaluation did not complete' },
|
|
}, {
|
|
event: 'error',
|
|
pending: [],
|
|
error: {
|
|
code: 'probe_failure',
|
|
message:
|
|
'Target process exited during probe evaluation. ' +
|
|
'If the failure repeats, review the probe expression.',
|
|
probe: 0,
|
|
stderr: '',
|
|
details: { lastCdpMethod: 'Debugger.evaluateOnCallFrame' },
|
|
},
|
|
}],
|
|
});
|
|
},
|
|
trim: true,
|
|
});
|