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

Method callCli

tests/integration/utils/fixture.ts:98–116  ·  view source on GitHub ↗

* Calls the CLI with a max timeout inside the fixture directory. * If the `parseJson` argument is specified then the result will be converted into an object.

(
    args: string[],
    { execOptions = {}, offline = true, parseJson = false }: CallCliOptions = {},
  )

Source from the content-addressed store, hash-verified

96 * If the `parseJson` argument is specified then the result will be converted into an object.
97 */
98 async callCli(
99 args: string[],
100 { execOptions = {}, offline = true, parseJson = false }: CallCliOptions = {},
101 ): Promise<Record<string, unknown> | string> {
102 let cliOptions: NodeOptions = execOptions
103 if (this.options.apiUrl) {
104 cliOptions = getCLIOptions({ apiUrl: this.options.apiUrl, env: execOptions.env })
105 }
106
107 // @ts-expect-error: Intentionally ignoring read-only property annotation
108 cliOptions.cwd = this.directory
109
110 if (offline) {
111 args.push('--offline')
112 }
113
114 // eslint-disable-next-line @typescript-eslint/no-unsafe-return
115 return callCli(args, cliOptions, parseJson)
116 }
117}
118
119type TestFactory = () => Promise<void> | void

Callers 7

blobs.test.tsFile · 0.80
env-list.test.tsFile · 0.80
env-set.test.tsFile · 0.80
env-get.test.tsFile · 0.80
env-unset.test.tsFile · 0.80
status.test.tsFile · 0.80

Calls 2

callCliFunction · 0.85
getCLIOptionsFunction · 0.70

Tested by

no test coverage detected