From 40b718f48bf3ee8dca4a66f3629eaa7f975e86f7 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sun, 2 Sep 2018 17:51:23 +0200 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/22150 --- test/parallel/test-fs-write-file-typedarrays.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-fs-write-file-typedarrays.js b/test/parallel/test-fs-write-file-typedarrays.js index e9bd9fe9a7a540..eca22750f6f903 100644 --- a/test/parallel/test-fs-write-file-typedarrays.js +++ b/test/parallel/test-fs-write-file-typedarrays.js @@ -32,10 +32,11 @@ for (const expectView of common.getArrayBufferViews(inputBuffer)) { for (const expectView of common.getArrayBufferViews(inputBuffer)) { console.log('Async test for ', expectView[Symbol.toStringTag]); - fs.writeFile(filename, expectView, common.mustCall((e) => { + const file = `${filename}-${expectView[Symbol.toStringTag]}`; + fs.writeFile(file, expectView, common.mustCall((e) => { assert.ifError(e); - fs.readFile(filename, 'utf8', common.mustCall((err, data) => { + fs.readFile(file, 'utf8', common.mustCall((err, data) => { assert.ifError(err); assert.strictEqual(data, inputBuffer.toString('utf8')); }));