From 03e1ba5ddcf885823859f334eff25c658458730a Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Fri, 6 Sep 2024 12:49:23 -0400 Subject: [PATCH] test: reduce fs calls in test-fs-existssync-false --- test/parallel/test-fs-existssync-false.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/test/parallel/test-fs-existssync-false.js b/test/parallel/test-fs-existssync-false.js index e81e6c7a311668..43e826cef5698e 100644 --- a/test/parallel/test-fs-existssync-false.js +++ b/test/parallel/test-fs-existssync-false.js @@ -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');