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

Function jsonifyTestdir

deps/npm/test/lib/commands/diff.js:6–17  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

4const { load: loadMockNpm } = require('../../fixtures/mock-npm')
5
6const jsonifyTestdir = (obj) => {
7 for (const [key, value] of Object.entries(obj || {})) {
8 if (extname(key) === '.json') {
9 obj[key] = JSON.stringify(value, null, 2) + '\n'
10 } else if (typeof value === 'object') {
11 obj[key] = jsonifyTestdir(value)
12 } else {
13 obj[key] = value.trim() + '\n'
14 }
15 }
16 return obj
17}
18
19// generic helper to call diff with a specified dir contents and registry calls
20const mockDiff = async (t, {

Callers 1

mockDiffFunction · 0.85

Calls 2

extnameFunction · 0.50
entriesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…