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

Function replace

deps/npm/test/fixtures/tmock.js:11–20  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

9// before/after npm is loaded. This helper replaces {BIN} and {LIB} with
10// the absolute path to those directories
11const replace = (s) => {
12 if (/^[./{]/.test(s)) {
13 return s
14 .replace(/^\{BIN\}/, BIN)
15 .replace(/^\{LIB\}/, LIB)
16 .replace(/^\{ROOT\}/, ROOT)
17 } else {
18 return require.resolve(s)
19 }
20}
21
22const tmock = (t, p, mocks = {}) => {
23 const entries = Object.entries(mocks).map(([k, v]) => [replace(k), v])

Callers 1

tmockFunction · 0.70

Calls 2

testMethod · 0.45
resolveMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…