Skip to content

Commit 422529a

Browse files
authored
test: force GC in test-file-write-stream4
Reduce `test/parallel/test-file-write-stream4.js` flakiness. Refs: #57927 PR-URL: #57930 Reviewed-By: James M Snell <[email protected]> Reviewed-By: LiviaMedeiros <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]>
1 parent 2e0ec72 commit 422529a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/parallel/test-file-write-stream4.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Flags: --expose-gc
12
'use strict';
23

34
// Test that 'close' emits once and not twice when `emitClose: true` is set.
@@ -17,4 +18,8 @@ const fileWriteStream = fs.createWriteStream(filepath, {
1718
});
1819

1920
fileReadStream.pipe(fileWriteStream);
20-
fileWriteStream.on('close', common.mustCall());
21+
fileWriteStream.on('close', common.mustCall(() => {
22+
// TODO(lpinca): Remove the forced GC when
23+
// https://github.com/nodejs/node/issues/54918 is fixed.
24+
globalThis.gc({ type: 'major' });
25+
}));

0 commit comments

Comments
 (0)