MCPcopy Create free account
hub / github.com/angular/dev-infra / getMockGitClient

Function getMockGitClient

ng-dev/utils/testing/git-client-mock.ts:15–29  ·  view source on GitHub ↗
(
  github: GithubConfig,
  useSandboxGitClient: T,
)

Source from the content-addressed store, hash-verified

13
14/** Gets a mock instance for the `GitClient` instance. */
15export 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}

Callers 6

changelog.spec.tsFile · 0.85
common.spec.tsFile · 0.85
generation.spec.tsFile · 0.85
publish-ci.spec.tsFile · 0.85

Calls 1

createInstanceMethod · 0.45

Tested by

no test coverage detected