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

Function mockReify

deps/npm/test/lib/utils/reify-output.js:7–29  ·  view source on GitHub ↗
(t, reify, { command, ...config } = {})

Source from the content-addressed store, hash-verified

5t.cleanSnapshot = str => str.replace(/in [0-9]+m?s/g, 'in {TIME}')
6
7const mockReify = async (t, reify, { command, ...config } = {}) => {
8 const mock = await mockNpm(t, {
9 command,
10 config,
11 })
12
13 // Hack to adapt existing fake test. Make npm.command
14 // return whatever was passed in to this function.
15 // What it should be doing is npm.exec(command) but that
16 // breaks most of these tests because they don't expect
17 // a command to actually run.
18 Object.defineProperty(mock.npm, 'command', {
19 get () {
20 return command
21 },
22 enumerable: true,
23 })
24
25 reifyOutput(mock.npm, reify)
26 mock.npm.finish()
27
28 return mock.joinedOutput()
29}
30
31t.test('missing info', async t => {
32 const out = await mockReify(t, {

Callers 2

reify-output.jsFile · 0.85
testCaseFunction · 0.85

Calls 4

reifyOutputFunction · 0.85
mockNpmFunction · 0.50
definePropertyMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…