Skip to content

Commit cb15017

Browse files
addaleaxtargos
authored andcommitted
test: fix flaky parallel/test-fs-write-file-typedarrays
Using the same filename for different async tests could lead to race conditions. Example failure: https://travis-ci.com/nodejs/node/jobs/143351655 Refs: #22150 PR-URL: #22659 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 71502f2 commit cb15017

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test/parallel/test-fs-write-file-typedarrays.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ for (const expectView of common.getArrayBufferViews(inputBuffer)) {
3232

3333
for (const expectView of common.getArrayBufferViews(inputBuffer)) {
3434
console.log('Async test for ', expectView[Symbol.toStringTag]);
35-
fs.writeFile(filename, expectView, common.mustCall((e) => {
35+
const file = `${filename}-${expectView[Symbol.toStringTag]}`;
36+
fs.writeFile(file, expectView, common.mustCall((e) => {
3637
assert.ifError(e);
3738

38-
fs.readFile(filename, 'utf8', common.mustCall((err, data) => {
39+
fs.readFile(file, 'utf8', common.mustCall((err, data) => {
3940
assert.ifError(err);
4041
assert.strictEqual(data, inputBuffer.toString('utf8'));
4142
}));

0 commit comments

Comments
 (0)