spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / mods / diff / tests / git.test.ts
31 lines · 854 BRaw
1import { describe, expect, test, tier } from 'claude-code/testing'
2
3import Fixtures from './fixtures'
4
5tier('builtin')
6
7describe('git', () => {
8 test('each git child runs pinned to /work, in C locale', async ($, on) => {
9 const world = Fixtures.inRepository(on)
10
11 await $.session.start(Fixtures.SESSION)
12 await $.command.run(Fixtures.DIFF)
13 await world.clock.advance(Fixtures.SETTLE_MS)
14
15 const [discovery, ...pinned] = world.runs
16
17 expect(discovery?.argv).toContain('--show-toplevel')
18 expect(discovery?.init?.cwd).toBeUndefined()
19 expect(pinned.length).toBeGreaterThan(0)
20
21 for (const run of pinned) {
22 expect(run.argv.slice(0, 3)).toEqual([
23 'git',
24 '--git-dir=/work/.git',
25 '--work-tree=/work',
26 ])
27
28 expect(run.init).toMatchObject({ cwd: '/work', env: { LC_ALL: 'C' } })
29 }
30 })
31})