From c860e4b4a98ceff048ac7a9bed48fec84f733a2d Mon Sep 17 00:00:00 2001 From: Xander Deseyn Date: Sat, 31 Oct 2020 13:16:13 +0100 Subject: [PATCH] Add mocha fix --- src/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/index.ts b/src/index.ts index e329402..272dfa2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -60,6 +60,10 @@ task("watch", "Start the file watcher").setAction( ); try { await run(task.command, task.params); + // This hack is required to allow running Mocha commands. Check out https://github.com/mochajs/mocha/issues/1938 for more details. + Object.keys(require.cache).forEach(function (key) { + delete require.cache[key]; + }); } catch (err) { console.log(`Task "${task.command}" failed.`); console.log(err);