MCPcopy Create free account
hub / github.com/netlify/cli / createMock

Function createMock

tests/integration/utils/mock-execa.ts:10–25  ·  view source on GitHub ↗
(contents: string)

Source from the content-addressed store, hash-verified

8// A cleanup method is also returned, allowing the consumer to remove the
9// mock file.
10export const createMock = async (contents: string) => {
11 const path = temporaryFile({ extension: 'js' })
12
13 await writeFile(path, contents)
14
15 const env = {
16 // windows needs 'file://' paths
17 NETLIFY_CLI_EXECA_PATH: pathToFileURL(path).href,
18 }
19 const cleanup = () =>
20 rm(path, { force: true, recursive: true }).catch(() => {
21 // no-op
22 })
23
24 return [env, cleanup] as const
25}

Callers 1

clone.test.tsFile · 0.85

Calls 2

temporaryFileFunction · 0.85
writeFileFunction · 0.50

Tested by

no test coverage detected