mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 10:15:07 +08:00
This option provides a new way of terminating the probing by specifying a limit for the per-probe hit evaluation. When any probe reaches the limit, the session removes the V8 breakpoints and finishes with a `completed` terminal event rather than waiting for the target to exit or timeout. This would be useful when we provide a way to attach to and probe a running process in the future. Signed-off-by: Joyee Cheung <joyeec9h3@gmail.com> PR-URL: https://github.com/nodejs/node/pull/63704 Refs: https://github.com/nodejs/node/issues/63646 Reviewed-By: Jan Martin <jan.krems@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
41 lines
1.5 KiB
JavaScript
41 lines
1.5 KiB
JavaScript
// This tests that probe mode rejects malformed --max-hit usage.
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
common.skipIfInspectorDisabled();
|
|
|
|
const fixtures = require('../common/fixtures');
|
|
const { assertProbeCliError } = require('../common/debugger-probe');
|
|
|
|
const cwd = fixtures.path('debugger');
|
|
|
|
// --max-hit before any --probe.
|
|
assertProbeCliError(
|
|
['--max-hit', '1', '--probe', 'probe.js:12', '--expr', 'finalValue', 'probe.js'],
|
|
/Unexpected --max-hit before --probe/, { cwd });
|
|
|
|
// --max-hit between a --probe and its --expr.
|
|
assertProbeCliError(
|
|
['--probe', 'probe.js:12', '--max-hit', '1', '--expr', 'finalValue', 'probe.js'],
|
|
/Each --probe must be followed immediately by --expr/, { cwd });
|
|
|
|
// Duplicate --max-hit for a single probe.
|
|
assertProbeCliError(
|
|
['--probe', 'probe.js:12', '--expr', 'finalValue', '--max-hit', '1', '--max-hit', '2', 'probe.js'],
|
|
/Duplicate --max-hit for a single --probe/, { cwd });
|
|
|
|
// Non-numeric value.
|
|
assertProbeCliError(
|
|
['--probe', 'probe.js:12', '--expr', 'finalValue', '--max-hit', 'abc', 'probe.js'],
|
|
/Invalid max-hit: abc/, { cwd });
|
|
|
|
// Zero is not allowed (limit must be at least 1).
|
|
assertProbeCliError(
|
|
['--probe', 'probe.js:12', '--expr', 'finalValue', '--max-hit', '0', 'probe.js'],
|
|
/Invalid max-hit: 0/, { cwd });
|
|
|
|
// Missing value: --max-hit as the final token has nothing to consume.
|
|
assertProbeCliError(
|
|
['--probe', 'probe.js:12', '--expr', 'finalValue', '--max-hit'],
|
|
/Missing value for --max-hit/, { cwd });
|