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 PR-URL: https://github.com/nodejs/node/pull/22659 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
parent
64cf96d684
commit
ba43bce9e2
@ -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'));
|
||||
}));
|
||||
|
Loading…
x
Reference in New Issue
Block a user