From d1a411480a876bdac8ab5cd3b79b1c7a6f430379 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Wed, 11 Sep 2024 17:22:54 -0400 Subject: [PATCH] test: reduce fs calls in test-fs-existssync-false PR-URL: https://github.com/nodejs/node/pull/54815 Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig --- 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');