From a8c67d7625b3ba9f983a025850898b9201357cd4 Mon Sep 17 00:00:00 2001 From: Brian C Date: Mon, 18 Mar 2024 09:33:10 +1100 Subject: [PATCH] fix tests --- cli/src/commands/__tests__/runTests-test.js | 2 +- cli/src/commands/runTests.js | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cli/src/commands/__tests__/runTests-test.js b/cli/src/commands/__tests__/runTests-test.js index e08c70fe87..5dc910b611 100644 --- a/cli/src/commands/__tests__/runTests-test.js +++ b/cli/src/commands/__tests__/runTests-test.js @@ -12,7 +12,7 @@ const runTest = async (mockConsole: boolean) => { path: path.join(__dirname, '__runTests-fixtures__'), }; return await run(args); -} +}; describe('run-tests (command)', () => { describe('regression 1385', () => { diff --git a/cli/src/commands/runTests.js b/cli/src/commands/runTests.js index be57cdd647..1dd1bdbb14 100644 --- a/cli/src/commands/runTests.js +++ b/cli/src/commands/runTests.js @@ -1,4 +1,5 @@ // @flow +import fileSys from 'fs'; import {child_process, fs, os, path} from '../lib/node.js'; import {copyFile, recursiveRmdir} from '../lib/fileUtils.js'; @@ -489,7 +490,14 @@ async function removeTrashFromBinDir() { (await fs.readdir(path.join(BIN_DIR))) .filter(name => !checkFlowFilename(name)) .forEach(async el => { - await fs.unlink(path.resolve(BIN_DIR, el)); + const dir = path.resolve(BIN_DIR, el); + if (fs.exists(dir)) { + if (fileSys.lstatSync(dir).isDirectory()) { + fs.rm(dir, {recursive: true}); + } else { + await fs.unlink(dir); + } + } }); }