test: reduce fs calls in test-fs-existssync-false

PR-URL: https://github.com/nodejs/node/pull/54815
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Yagiz Nizipli 2024-09-11 17:22:54 -04:00 committed by GitHub
parent 0f2f9b6b15
commit cc780ddf1e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -18,15 +18,13 @@ tmpdir.refresh();
// Make a long path.
for (let i = 0; i < 50; i++) {
dir = `${dir}/1234567890`;
try {
fs.mkdirSync(dir, '0777');
} catch (e) {
if (e.code !== 'EEXIST') {
throw e;
}
}
}
fs.mkdirSync(dir, {
mode: '0777',
recursive: true,
});
// Test if file exists synchronously
assert(fs.existsSync(dir), 'Directory is not accessible');