1
- import { exec } from "child_process" ;
2
- import { mkdtemp , rm } from "fs/promises" ;
3
- import { tmpdir } from "os" ;
4
- import { join } from "path/posix" ;
5
- import { promisify } from "util" ;
1
+ import { exec } from "child_process" ;
2
+ import { mkdtemp , rm } from "fs/promises" ;
3
+ import { tmpdir } from "os" ;
4
+ import { join } from "path/posix" ;
5
+ import { promisify } from "util" ;
6
6
7
- export function mockIsolatedDirectory ( { git } : { git : boolean ; } ) {
7
+ export function mockIsolatedDirectory ( { git} : { git : boolean } ) {
8
8
let dir : string ;
9
9
let cwd : string ;
10
10
beforeEach ( async ( ) => {
@@ -13,15 +13,17 @@ export function mockIsolatedDirectory({ git }: { git: boolean; }) {
13
13
process . chdir ( dir ) ;
14
14
if ( git ) {
15
15
console . log ( "logging stdout, stderr" ) ;
16
- const a = ( await promisify ( exec ) ( "git config --global init.defaultBranch main" ) )
16
+ const a = await promisify ( exec ) (
17
+ "git config --global user.email \"[email protected] \"; git config --global user.name \"Your Name\"; git config --global init.defaultBranch main"
18
+ ) ;
17
19
console . log ( a . stdout , a . stderr ) ;
18
- const b = ( await promisify ( exec ) ( "git init" ) ) ;
20
+ const b = await promisify ( exec ) ( "git init" ) ;
19
21
console . log ( b . stdout , b . stderr ) ;
20
- } ;
22
+ }
21
23
} ) ;
22
24
23
25
afterEach ( async ( ) => {
24
26
process . chdir ( cwd ) ;
25
- await rm ( dir , { recursive : true } ) ;
27
+ await rm ( dir , { recursive : true } ) ;
26
28
} ) ;
27
29
}
0 commit comments