(value)
| 28 | // Replace volatile fields in a probe report (stack frames, Node.js version, |
| 29 | // scriptId, callFrames) with stable placeholders for deepStrictEqual. |
| 30 | function 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 | |
| 55 | function assertProbeJson(output, expected) { |
| 56 | const normalized = typeof output === 'string' ? JSON.parse(output) : output; |
no test coverage detected
searching dependent graphs…