@@ -42,7 +42,7 @@ interface TestContext {
4242 exec ( command : string , options ?: ChildProcessOptions , execOptions ?: ExecOptions ) : Promise < string >
4343 spawn ( command : string , options ?: ChildProcessOptions ) : Promise < SpawnedProcess >
4444 fs : {
45- write ( filePath : string , content : string ) : Promise < void >
45+ write ( filePath : string , content : string , encoding ?: BufferEncoding ) : Promise < void >
4646 create ( filePaths : string [ ] ) : Promise < void >
4747 read ( filePath : string ) : Promise < string >
4848 glob ( pattern : string ) : Promise < [ string , string ] [ ] >
@@ -268,7 +268,11 @@ export function test(
268268 }
269269 } ,
270270 fs : {
271- async write ( filename : string , content : string | Uint8Array ) : Promise < void > {
271+ async write (
272+ filename : string ,
273+ content : string | Uint8Array ,
274+ encoding : BufferEncoding = 'utf8' ,
275+ ) : Promise < void > {
272276 let full = path . join ( root , filename )
273277 let dir = path . dirname ( full )
274278 await fs . mkdir ( dir , { recursive : true } )
@@ -286,7 +290,7 @@ export function test(
286290 content = content . replace ( / \n / g, '\r\n' )
287291 }
288292
289- await fs . writeFile ( full , content , 'utf-8' )
293+ await fs . writeFile ( full , content , encoding )
290294 } ,
291295
292296 async create ( filenames : string [ ] ) : Promise < void > {
0 commit comments