Skip to content

Commit 8f49b7c

Browse files
anonrigtargos
authored andcommittedOct 2, 2024
test: reduce fs calls in test-fs-existssync-false
PR-URL: #54815 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent 096623b commit 8f49b7c

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed
 

‎test/parallel/test-fs-existssync-false.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,13 @@ tmpdir.refresh();
1818
// Make a long path.
1919
for (let i = 0; i < 50; i++) {
2020
dir = `${dir}/1234567890`;
21-
try {
22-
fs.mkdirSync(dir, '0777');
23-
} catch (e) {
24-
if (e.code !== 'EEXIST') {
25-
throw e;
26-
}
27-
}
2821
}
2922

23+
fs.mkdirSync(dir, {
24+
mode: '0777',
25+
recursive: true,
26+
});
27+
3028
// Test if file exists synchronously
3129
assert(fs.existsSync(dir), 'Directory is not accessible');
3230

0 commit comments

Comments
 (0)
Please sign in to comment.