@@ -4,36 +4,30 @@ import { git } from "../../src/util/git"
44
55describe ( "git() utility" , ( ) => {
66 test ( "runs a simple git command and returns stdout" , async ( ) => {
7- // Use tmpdir without git:true to avoid commit signing issues; just git init manually
8- await using tmp = await tmpdir ( )
9- await Bun . spawn ( [ "git" , "init" ] , { cwd : tmp . path , stdout : "ignore" , stderr : "ignore" } ) . exited
10- await Bun . spawn ( [ "git" , "config" , "core.fsmonitor" , "false" ] , { cwd : tmp . path , stdout : "ignore" , stderr : "ignore" } ) . exited
7+ await using tmp = await tmpdir ( { git : true } )
118
129 const result = await git ( [ "rev-parse" , "--is-inside-work-tree" ] , { cwd : tmp . path } )
1310 expect ( result . exitCode ) . toBe ( 0 )
1411 expect ( result . text ( ) . trim ( ) ) . toBe ( "true" )
1512 } )
1613
1714 test ( "returns non-zero exit code for unknown git subcommand" , async ( ) => {
18- await using tmp = await tmpdir ( )
19- await Bun . spawn ( [ "git" , "init" ] , { cwd : tmp . path , stdout : "ignore" , stderr : "ignore" } ) . exited
15+ await using tmp = await tmpdir ( { git : true } )
2016
2117 const result = await git ( [ "not-a-real-subcommand" ] , { cwd : tmp . path } )
2218 expect ( result . exitCode ) . not . toBe ( 0 )
2319 } )
2420
2521 test ( "stderr is populated on error" , async ( ) => {
26- await using tmp = await tmpdir ( )
27- await Bun . spawn ( [ "git" , "init" ] , { cwd : tmp . path , stdout : "ignore" , stderr : "ignore" } ) . exited
22+ await using tmp = await tmpdir ( { git : true } )
2823
2924 const result = await git ( [ "checkout" , "nonexistent-branch-xyz" ] , { cwd : tmp . path } )
3025 expect ( result . exitCode ) . not . toBe ( 0 )
3126 expect ( result . stderr . length ) . toBeGreaterThan ( 0 )
3227 } )
3328
3429 test ( "passes custom env vars through to git process" , async ( ) => {
35- await using tmp = await tmpdir ( )
36- await Bun . spawn ( [ "git" , "init" ] , { cwd : tmp . path , stdout : "ignore" , stderr : "ignore" } ) . exited
30+ await using tmp = await tmpdir ( { git : true } )
3731
3832 // Use GIT_CONFIG_COUNT to inject a config value that only exists via env
3933 const result = await git ( [ "config" , "--get" , "test.injected" ] , {
0 commit comments