From cc780ddf1e657e1f0104b7be86572f09218726d6 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 e81e6c7a311..43e826cef56 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');