( github: GithubConfig, useSandboxGitClient: T, )
| 13 | |
| 14 | /** Gets a mock instance for the `GitClient` instance. */ |
| 15 | export function getMockGitClient<T extends boolean>( |
| 16 | github: GithubConfig, |
| 17 | useSandboxGitClient: T, |
| 18 | ): T extends true ? SandboxGitClient : VirtualGitClient { |
| 19 | if (useSandboxGitClient) { |
| 20 | // TypeScript does not infer the return type for the implementation, so we cast |
| 21 | // to any. The function signature will have the proper conditional return type. |
| 22 | // The Git binary path will be passed to this test process as command line argument. |
| 23 | // See `ng-dev/release/publish/test/BUILD.bazel` and the `GIT_BIN_PATH` variable |
| 24 | // that is exposed from the Git bazel toolchain. |
| 25 | return SandboxGitClient.createInstance(process.env['GIT_BIN']!, {github}, testTmpDir) as any; |
| 26 | } else { |
| 27 | return VirtualGitClient.createInstance({github}); |
| 28 | } |
| 29 | } |
no test coverage detected