Skip to content

Commit 8048c2e

Browse files
sungpakstargos
authored andcommitted
test: improve test-internal-fs-syncwritestream
A subtest about the behavior when `autoClose=false`. PR-URL: #54671 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 597bc14 commit 8048c2e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/parallel/test-internal-fs-syncwritestream.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,18 @@ const filename = tmpdir.resolve('sync-write-stream.txt');
6666
assert.strictEqual(stream.fd, null);
6767
}
6868

69+
// Verify that the file is not closed when autoClose=false
70+
{
71+
const fd = fs.openSync(filename, 'w');
72+
const stream = new SyncWriteStream(fd, { autoClose: false });
73+
74+
stream.on('close', common.mustCall());
75+
76+
assert.strictEqual(stream.destroy(), stream);
77+
fs.fstatSync(fd); // Does not throw
78+
fs.closeSync(fd);
79+
}
80+
6981
// Verify that calling end() will also destroy the stream.
7082
{
7183
const fd = fs.openSync(filename, 'w');

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy