@@ -13,6 +13,7 @@ import { fileURLToPath } from "node:url";
13
13
const moduleDir = dirname ( fileURLToPath ( import . meta. url ) ) ;
14
14
const testdataDir = resolve ( moduleDir , "testdata" ) ;
15
15
const readTestFile = join ( testdataDir , "copy_file.txt" ) ;
16
+ const isBun = navigator . userAgent . includes ( "Bun/" ) ;
16
17
17
18
Deno . test ( "FsFile object writes to a newly created file" , async ( ) => {
18
19
const tempDirPath = await makeTempDir ( { prefix : "FsFile_write_" } ) ;
@@ -126,39 +127,47 @@ Deno.test("FsFile object returns the 'stat' of the file handle", async () => {
126
127
fh . close ( ) ;
127
128
} ) ;
128
129
129
- Deno . test ( "FsFile object handles a ReadableStream" , async ( ) => {
130
- const fh = await open ( readTestFile ) ;
131
- assert ( fh . readable instanceof ReadableStream ) ;
132
- const chunks = [ ] ;
133
- for await ( const chunk of fh . readable ) {
134
- chunks . push ( chunk ) ;
135
- }
136
- assertEquals ( chunks . length , 1 ) ;
137
- if ( chunks [ 0 ] != null ) {
138
- assertEquals ( chunks [ 0 ] . byteLength , 3 ) ;
139
- }
140
- } ) ;
141
-
142
- Deno . test ( "FsFile object handles a WritableStream" , async ( ) => {
143
- const tempDirPath = await makeTempDir ( { prefix : "FsFile_WritableStream_" } ) ;
144
- const testFile = join ( tempDirPath , "testFile.txt" ) ;
145
- const fh = await open ( testFile , { create : true , write : true } ) ;
146
- assert ( fh . writable instanceof WritableStream ) ;
147
- const rs = new ReadableStream ( {
148
- start ( controller ) {
149
- const encoder = new TextEncoder ( ) ;
150
- controller . enqueue ( encoder . encode ( "Hello," ) ) ;
151
- controller . enqueue ( encoder . encode ( " Standard" ) ) ;
152
- controller . enqueue ( encoder . encode ( " Library" ) ) ;
153
- controller . close ( ) ;
154
- } ,
155
- } ) ;
156
- await rs . pipeTo ( fh . writable ) ;
157
- const readText = await readTextFile ( testFile ) ;
158
- assertEquals ( readText , "Hello, Standard Library" ) ;
159
-
160
- await remove ( tempDirPath , { recursive : true } ) ;
161
- } ) ;
130
+ Deno . test (
131
+ "FsFile object handles a ReadableStream" ,
132
+ { ignore : isBun } ,
133
+ async ( ) => {
134
+ const fh = await open ( readTestFile ) ;
135
+ assert ( fh . readable instanceof ReadableStream ) ;
136
+ const chunks = [ ] ;
137
+ for await ( const chunk of fh . readable ) {
138
+ chunks . push ( chunk ) ;
139
+ }
140
+ assertEquals ( chunks . length , 1 ) ;
141
+ if ( chunks [ 0 ] != null ) {
142
+ assertEquals ( chunks [ 0 ] . byteLength , 3 ) ;
143
+ }
144
+ } ,
145
+ ) ;
146
+
147
+ Deno . test (
148
+ "FsFile object handles a WritableStream" ,
149
+ { ignore : isBun } ,
150
+ async ( ) => {
151
+ const tempDirPath = await makeTempDir ( { prefix : "FsFile_WritableStream_" } ) ;
152
+ const testFile = join ( tempDirPath , "testFile.txt" ) ;
153
+ const fh = await open ( testFile , { create : true , write : true } ) ;
154
+ assert ( fh . writable instanceof WritableStream ) ;
155
+ const rs = new ReadableStream ( {
156
+ start ( controller ) {
157
+ const encoder = new TextEncoder ( ) ;
158
+ controller . enqueue ( encoder . encode ( "Hello," ) ) ;
159
+ controller . enqueue ( encoder . encode ( " Standard" ) ) ;
160
+ controller . enqueue ( encoder . encode ( " Library" ) ) ;
161
+ controller . close ( ) ;
162
+ } ,
163
+ } ) ;
164
+ await rs . pipeTo ( fh . writable ) ;
165
+ const readText = await readTextFile ( testFile ) ;
166
+ assertEquals ( readText , "Hello, Standard Library" ) ;
167
+
168
+ await remove ( tempDirPath , { recursive : true } ) ;
169
+ } ,
170
+ ) ;
162
171
163
172
Deno . test ( "FsFile object changes access and modification times with utime" , async ( ) => {
164
173
const tempFile = await makeTempFile ( { prefix : "FsFile_utime_" } ) ;
@@ -232,28 +241,32 @@ Deno.test("FsFile object synchronously reads from an existing file", () => {
232
241
fh . close ( ) ;
233
242
} ) ;
234
243
235
- Deno . test ( "FsFile object synchronously truncates a file to zero" , ( ) => {
236
- const tempDirPath = makeTempDirSync ( { prefix : "FsFile_truncateSync_" } ) ;
237
- const testFile = join ( tempDirPath , "testFile.txt" ) ;
238
- let fh = openSync ( testFile , { read : true , write : true , create : true } ) ;
239
-
240
- const encoder = new TextEncoder ( ) ;
241
- const data = encoder . encode ( "Hello, Standard Library" ) ;
242
- const writeBytes = fh . writeSync ( data ) ;
243
- assertEquals ( writeBytes , 23 ) ;
244
- fh . close ( ) ;
244
+ Deno . test (
245
+ "FsFile object synchronously truncates a file to zero" ,
246
+ { ignore : isBun } ,
247
+ ( ) => {
248
+ const tempDirPath = makeTempDirSync ( { prefix : "FsFile_truncateSync_" } ) ;
249
+ const testFile = join ( tempDirPath , "testFile.txt" ) ;
250
+ let fh = openSync ( testFile , { read : true , write : true , create : true } ) ;
251
+
252
+ const encoder = new TextEncoder ( ) ;
253
+ const data = encoder . encode ( "Hello, Standard Library" ) ;
254
+ const writeBytes = fh . writeSync ( data ) ;
255
+ assertEquals ( writeBytes , 23 ) ;
256
+ fh . close ( ) ;
245
257
246
- fh = openSync ( testFile , { read : true , write : true } ) ;
247
- fh . truncateSync ( ) ;
258
+ fh = openSync ( testFile , { read : true , write : true } ) ;
259
+ fh . truncateSync ( ) ;
248
260
249
- const buf = new Uint8Array ( 10 ) ;
250
- const readBytes = fh . readSync ( buf ) ;
251
- // Reading a 0 byte file should return null at EOF.
252
- assertEquals ( readBytes , null ) ;
253
- fh . close ( ) ;
261
+ const buf = new Uint8Array ( 10 ) ;
262
+ const readBytes = fh . readSync ( buf ) ;
263
+ // Reading a 0 byte file should return null at EOF.
264
+ assertEquals ( readBytes , null ) ;
265
+ fh . close ( ) ;
254
266
255
- removeSync ( tempDirPath , { recursive : true } ) ;
256
- } ) ;
267
+ removeSync ( tempDirPath , { recursive : true } ) ;
268
+ } ,
269
+ ) ;
257
270
258
271
Deno . test ( "FsFile object synchronously truncates files to multiple sizes" , ( ) => {
259
272
const tempDirPath = makeTempDirSync ( { prefix : "FsFile_truncateSync_" } ) ;
0 commit comments