From cb15017bfef21022b84acb212be238217662d331 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 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 PR-URL: https://github.com/nodejs/node/pull/22659 Reviewed-By: Ruben Bridgewater Reviewed-By: Michaƫl Zasso Reviewed-By: Rich Trott --- 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')); }));