From cd6874b2b00ce6bf0dc61f270fc8b73b4f99d947 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 12 Sep 2022 15:16:31 +0100 Subject: [PATCH] Fixing an intermettient test issue. --- packages/server/src/utilities/fileSystem/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/server/src/utilities/fileSystem/index.js b/packages/server/src/utilities/fileSystem/index.js index 518bcc62bd..885b167d5e 100644 --- a/packages/server/src/utilities/fileSystem/index.js +++ b/packages/server/src/utilities/fileSystem/index.js @@ -44,7 +44,15 @@ const NODE_MODULES_PATH = join(TOP_LEVEL_PATH, "node_modules") exports.init = () => { const tempDir = budibaseTempDir() if (!fs.existsSync(tempDir)) { - fs.mkdirSync(tempDir) + // some test cases fire this quickly enough that + // synchronous cases can end up here at the same time + try { + fs.mkdirSync(tempDir) + } catch (err) { + if (!err || err.code !== "EEXIST") { + throw err + } + } } const clientLibPath = join(budibaseTempDir(), "budibase-client.js") if (env.isTest() && !fs.existsSync(clientLibPath)) {