@@ -2,7 +2,6 @@ import { describe, expect, it } from "bun:test";
22import * as os from "os" ;
33import * as path from "path" ;
44import { LocalRuntime } from "./LocalRuntime" ;
5- import * as fs from "fs" ;
65import * as fsPromises from "fs/promises" ;
76import { execFileSync } from "child_process" ;
87import type { InitLogger } from "./Runtime" ;
@@ -87,11 +86,20 @@ function gitOutput(args: string[], cwd?: string): string {
8786}
8887
8988function createTestInitLogger ( ) : InitLogger {
89+ const logs : string [ ] = [ ] ;
9090 return {
91- logStep : ( ) => { } ,
92- logStdout : ( ) => { } ,
93- logStderr : ( ) => { } ,
94- logComplete : ( ) => { } ,
91+ logStep : ( m : string ) => {
92+ logs . push ( `[step] ${ m } ` ) ;
93+ } ,
94+ logStdout : ( line : string ) => {
95+ if ( line ) logs . push ( `[out] ${ line } ` ) ;
96+ } ,
97+ logStderr : ( line : string ) => {
98+ if ( line ) logs . push ( `[err] ${ line } ` ) ;
99+ } ,
100+ logComplete : ( code : number ) => {
101+ logs . push ( `[done] ${ code } ` ) ;
102+ } ,
95103 } ;
96104}
97105
@@ -107,17 +115,17 @@ describe("LocalRuntime auto rebase", () => {
107115 try {
108116 runGit ( [ "init" , "--bare" , originDir ] ) ;
109117
110- fs . mkdirSync ( projectDir , { recursive : true } ) ;
118+ await fsPromises . mkdir ( projectDir , { recursive : true } ) ;
111119 runGit ( [ "init" , "-b" , trunkBranch ] , projectDir ) ;
112120 runGit ( [ "remote" , "add" , "origin" , originDir ] , projectDir ) ;
113121
114- fs . writeFileSync ( path . join ( projectDir , "README.md" ) , "first\n" ) ;
122+ await fsPromises . writeFile ( path . join ( projectDir , "README.md" ) , "first\n" ) ;
115123 runGit ( [ "add" , "README.md" ] , projectDir ) ;
116124 runGit ( [ "commit" , "-m" , "initial" ] , projectDir ) ;
117125 runGit ( [ "push" , "-u" , "origin" , trunkBranch ] , projectDir ) ;
118126
119127 runGit ( [ "clone" , "-b" , trunkBranch , originDir , upstreamDir ] ) ;
120- fs . appendFileSync ( path . join ( upstreamDir , "README.md" ) , "second\n" ) ;
128+ await fsPromises . appendFile ( path . join ( upstreamDir , "README.md" ) , "second\n" ) ;
121129 runGit ( [ "commit" , "-am" , "upstream change" ] , upstreamDir ) ;
122130 runGit ( [ "push" , "origin" , trunkBranch ] , upstreamDir ) ;
123131
0 commit comments