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

Function mockExplain

deps/npm/test/lib/commands/explain.js:21–37  ·  view source on GitHub ↗
(t, opts)

Source from the content-addressed store, hash-verified

19})
20
21const mockExplain = async (t, opts) => {
22 const mock = await mockNpm(t, {
23 command: 'explain',
24 mocks: {
25 // keep the snapshots pared down a bit, since this has its own tests.
26 '{LIB}/utils/explain-dep.js': {
27 explainNode: (expl, depth, chalk) => {
28 const color = chalk.level !== 0
29 return `${expl.name}@${expl.version} depth=${depth} color=${color}`
30 },
31 },
32 },
33 ...opts,
34 })
35
36 return mock
37}
38
39t.test('no args throws usage', async t => {
40 const { explain } = await mockExplain(t)

Callers 3

explain.jsFile · 0.85
mockNodesFunction · 0.85
mockWorkspacesFunction · 0.85

Calls 1

mockNpmFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…