Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
  • Loading branch information
addaleax committed Sep 2, 2018
commit 40b718f48bf3ee8dca4a66f3629eaa7f975e86f7
5 changes: 3 additions & 2 deletions test/parallel/test-fs-write-file-typedarrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}));
Expand Down