@@ -42,7 +42,7 @@ interface TestContext {
42
42
exec ( command : string , options ?: ChildProcessOptions , execOptions ?: ExecOptions ) : Promise < string >
43
43
spawn ( command : string , options ?: ChildProcessOptions ) : Promise < SpawnedProcess >
44
44
fs : {
45
- write ( filePath : string , content : string ) : Promise < void >
45
+ write ( filePath : string , content : string , encoding ?: BufferEncoding ) : Promise < void >
46
46
create ( filePaths : string [ ] ) : Promise < void >
47
47
read ( filePath : string ) : Promise < string >
48
48
glob ( pattern : string ) : Promise < [ string , string ] [ ] >
@@ -268,7 +268,11 @@ export function test(
268
268
}
269
269
} ,
270
270
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 > {
272
276
let full = path . join ( root , filename )
273
277
let dir = path . dirname ( full )
274
278
await fs . mkdir ( dir , { recursive : true } )
@@ -286,7 +290,7 @@ export function test(
286
290
content = content . replace ( / \n / g, '\r\n' )
287
291
}
288
292
289
- await fs . writeFile ( full , content , 'utf-8' )
293
+ await fs . writeFile ( full , content , encoding )
290
294
} ,
291
295
292
296
async create ( filenames : string [ ] ) : Promise < void > {
0 commit comments