MCPcopy Index your code
hub / github.com/nodejs/node / normalizeProbeReport

Function normalizeProbeReport

test/common/debugger-probe.js:30–53  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

28// Replace volatile fields in a probe report (stack frames, Node.js version,
29// scriptId, callFrames) with stable placeholders for deepStrictEqual.
30function normalizeProbeReport(value) {
31 if (typeof value === 'string') {
32 return value
33 .replace(/(?:\n[ \t]+at\s[^\n]*)+/g, '\n<stack>')
34 .replace(/\nNode\.js v[^\n]+/g, '\nNode.js <version>');
35 }
36 if (Array.isArray(value)) {
37 return value.map(normalizeProbeReport);
38 }
39 if (value !== null && typeof value === 'object') {
40 const result = {};
41 for (const key of Object.keys(value)) {
42 if (key === 'scriptId') {
43 result[key] = '<scriptId>';
44 } else if (key === 'callFrames') {
45 result[key] = '<callFrames>';
46 } else {
47 result[key] = normalizeProbeReport(value[key]);
48 }
49 }
50 return result;
51 }
52 return value;
53}
54
55function assertProbeJson(output, expected) {
56 const normalized = typeof output === 'string' ? JSON.parse(output) : output;

Callers 1

assertProbeJsonFunction · 0.85

Calls 2

mapMethod · 0.65
keysMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…