Skip to content

Commit c25c736

Browse files
committed
git.test: cover the ucrt64 axis
Add a `getViaGit full ucrt64` companion to the existing `getViaGit full x86_64` test. The new test pins down the two behaviours that distinguish the UCRT64 variant from the MINGW64 one, both of which would silently regress to "secretly materialise the wrong toolchain" if broken: that the artifact name is `git-sdk-ucrt64-full` rather than `git-sdk-64-full` (so caches and on-disk output directories never collide with `x86_64`), and that the clone targets the `ucrt64` branch of `git-sdk-64` rather than `main`. The clone assertion goes via `spawnAndWaitForExitCode` rather than spying on `clone` itself, because internal callers of `clone()` within `git.ts` resolve the binding at module load time and the `vi.spyOn` override of the module export does not intercept them. The existing `full x86_64` test only mocks `clone` to silence side-effects, never to assert on its arguments, so the discrepancy in style is local to this one new test. Assisted-by: Opus 4.7 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent db44df7 commit c25c736

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

src/__tests__/git.test.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,37 @@ describe('git', () => {
9898
)
9999
expect(fs.rmSync).toHaveBeenCalledWith('.tmp', {recursive: true})
100100
})
101+
102+
test('getViaGit full ucrt64', async () => {
103+
const flavor = 'full'
104+
const architecture = 'ucrt64'
105+
const outputDirectory = 'outputDirectory'
106+
107+
const spawnSpy = vi
108+
.spyOn(spawn, 'spawnAndWaitForExitCode')
109+
.mockResolvedValue({
110+
exitCode: 0
111+
})
112+
113+
const {artifactName, download} = await git.getViaGit(flavor, architecture)
114+
115+
// The `ucrt64` axis shares the `git-sdk-64` repository with
116+
// `x86_64`, so the artifact name has to differ to keep caches and
117+
// on-disk directories distinct.
118+
expect(artifactName).toEqual('git-sdk-ucrt64-full')
119+
120+
await download(outputDirectory, true)
121+
122+
// The clone must target the `ucrt64` branch of `git-sdk-64`, not
123+
// `main`, otherwise the wrong toolchain would be materialised.
124+
expect(spawnSpy).toHaveBeenCalledWith(
125+
expect.stringContaining('/git.exe'),
126+
expect.arrayContaining([
127+
'clone',
128+
'--branch=ucrt64',
129+
'https://github.com/git-for-windows/git-sdk-64'
130+
]),
131+
expect.any(Object)
132+
)
133+
})
101134
})

0 commit comments

Comments
 (0)