-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
Expand file tree
/
Copy pathtest-debugger-probe-json-preview.js
More file actions
100 lines (96 loc) Β· 2.58 KB
/
test-debugger-probe-json-preview.js
File metadata and controls
100 lines (96 loc) Β· 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// 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,
});