* 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 = {},
)
| 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 | |
| 119 | type TestFactory = () => Promise<void> | void |
no test coverage detected