mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
This works around a pre-existing inspector issue: if the debuggee exits too quickly the inspector can segfault while tearing down. For now normalize the trailing segfault as completion to keep the CI green until the upstream bug is fixed, since it only reproduces on some slow CI machines and is not what the probe tests care about. PR-URL: https://github.com/nodejs/node/pull/62851 Refs: https://github.com/nodejs/node/issues/62765 Refs: https://github.com/nodejs/node/issues/58245 Reviewed-By: Jan Martin <jan.krems@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Filip Skokan <panva.ip@gmail.com>
101 lines
2.6 KiB
JavaScript
101 lines
2.6 KiB
JavaScript
// This tests debugger probe JSON preview opt-in for object-like values.
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
common.skipIfInspectorDisabled();
|
|
|
|
const { spawnSyncAndAssert } = require('../common/child_process');
|
|
const {
|
|
assertProbeJson,
|
|
probeTypesScript,
|
|
} = require('../common/debugger-probe');
|
|
|
|
const location = `${probeTypesScript}:17`;
|
|
|
|
spawnSyncAndAssert(process.execPath, [
|
|
'inspect',
|
|
'--json',
|
|
'--preview',
|
|
'--probe', location,
|
|
'--expr', 'objectValue',
|
|
'--probe', location,
|
|
'--expr', 'arrayValue',
|
|
'--probe', location,
|
|
'--expr', 'errorValue',
|
|
probeTypesScript,
|
|
], {
|
|
stdout(output) {
|
|
assertProbeJson(output, {
|
|
v: 1,
|
|
probes: [
|
|
{ expr: 'objectValue', target: [probeTypesScript, 17] },
|
|
{ expr: 'arrayValue', target: [probeTypesScript, 17] },
|
|
{ expr: 'errorValue', target: [probeTypesScript, 17] },
|
|
],
|
|
results: [
|
|
{
|
|
probe: 0,
|
|
event: 'hit',
|
|
hit: 1,
|
|
result: {
|
|
type: 'object',
|
|
description: 'Object',
|
|
preview: {
|
|
type: 'object',
|
|
description: 'Object',
|
|
overflow: false,
|
|
properties: [
|
|
{ name: 'alpha', type: 'number', value: '1' },
|
|
{ name: 'beta', type: 'string', value: 'two' },
|
|
],
|
|
},
|
|
},
|
|
},
|
|
{
|
|
probe: 1,
|
|
event: 'hit',
|
|
hit: 1,
|
|
result: {
|
|
type: 'object',
|
|
subtype: 'array',
|
|
description: 'Array(3)',
|
|
preview: {
|
|
type: 'object',
|
|
subtype: 'array',
|
|
description: 'Array(3)',
|
|
overflow: false,
|
|
properties: [
|
|
{ name: '0', type: 'number', value: '1' },
|
|
{ name: '1', type: 'string', value: 'two' },
|
|
{ name: '2', type: 'number', value: '3' },
|
|
],
|
|
},
|
|
},
|
|
},
|
|
{
|
|
probe: 2,
|
|
event: 'hit',
|
|
hit: 1,
|
|
result: {
|
|
type: 'object',
|
|
subtype: 'error',
|
|
description: 'Error: boom',
|
|
preview: {
|
|
type: 'object',
|
|
subtype: 'error',
|
|
description: 'Error: boom',
|
|
overflow: false,
|
|
properties: [
|
|
{ name: 'stack', type: 'string', value: 'Error: boom' },
|
|
{ name: 'message', type: 'string', value: 'boom' },
|
|
],
|
|
},
|
|
},
|
|
},
|
|
{ event: 'completed' },
|
|
],
|
|
});
|
|
},
|
|
trim: true,
|
|
});
|