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
29 lines · 852 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 const [discovery, ...pinned] = world.runs
15
16 expect(discovery?.argv).toContain('--show-toplevel')
17 expect(discovery?.init?.cwd).toBeUndefined()
18 expect(pinned.length).toBeGreaterThan(0)
19
20 for (const run of pinned) {
21 expect(run.argv.slice(0, 3)).toEqual([
22 'git',
23 '--git-dir=/work/.git',
24 '--work-tree=/work',
25 ])
26 expect(run.init).toMatchObject({ cwd: '/work', env: { LC_ALL: 'C' } })
27 }
28 })
29})