You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running the following test many times, sometimes (1 time every 10/20 runs) returns the following error:
error: Leaks detected:
- An async call to op_fs_open_async was started in this test, but never completed. The operation was started here:
at op_fs_open_async (ext:core/00_infra.js:265:13)
at Object.open (ext:deno_fs/30_fs.js:633:21)
at Object.open (ext:deno_node/_fs/_fs_open.ts:80:10)
at WriteStream._construct (ext:deno_node/internal/fs/streams.mjs:63:17)
at constructNT (ext:deno_node/_stream.mjs:1672:16)
at Array.processTicksAndRejections (ext:deno_node/_next_tick.ts:30:15)
at eventLoopTick (ext:core/01_core.js:150:29)
importfsfrom'node:fs';importosfrom'node:os';importpathfrom'node:path';import{test}from'node:test';importassertfrom'node:assert';/** @type {any} */constt=(typeofDeno!=='undefined') ? Deno.test : test;consttempDir=os.tmpdir();constfilePath=path.join(tempDir,'test.txt'+Date.now());constdata=Array.from({length: 10},(_,i)=>`Line àèéìòù ${i+1}`);t('createWriteStream (called 1 times): write txt to a file stream and read it back',async()=>{conststream=fs.createWriteStream(filePath,{flags: 'w',encoding: 'utf8'});// 'a' means append; 'w' means overwritestream.on('finish',()=>{constreadData=fs.readFileSync(filePath,'utf8');console.log(readData);constexpectedData=data.join('\n')+'\n';assert.strictEqual(readData,expectedData,'The read data was not correct');fs.unlinkSync(filePath);});stream.on('error',(err)=>{console.error('An error occurred:',err);});// Write each line to filefor(constlineofdata){if(!stream.write(line+'\n')){// Handle backpressure, waiting for the drain event before writing more dataawaitnewPromise((resolve)=>stream.once('drain',resolve));}}stream.end();});
The text was updated successfully, but these errors were encountered:
Looking closer, I see that you are using Deno.test when running on Deno. This means that the op and resource sanitizers are enabled, which means you might get occasional sanitizer failures.
You should be able to fix this by either 1) using node:test on Deno (which will disable the sanitizers for you) or 2) waiting for the stream close event with something like await new Promise(r => stream.on('close', r)).
Version: Deno 1.41.0 on Windows 11
Running the following test many times, sometimes (1 time every 10/20 runs) returns the following error:
The text was updated successfully, but these errors were encountered: