From 24aaa001911cd78da5dc38898f2443121491cfbf Mon Sep 17 00:00:00 2001 From: Kartones Date: Tue, 4 Jun 2024 10:45:52 +0200 Subject: [PATCH] fix: don't use disposed mocha instance to query parallel mode --- lib/cli/watch-run.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/cli/watch-run.js b/lib/cli/watch-run.js index 857fef35da..edddbe00ba 100644 --- a/lib/cli/watch-run.js +++ b/lib/cli/watch-run.js @@ -261,13 +261,14 @@ const createRerunner = (mocha, watcher, {beforeRun} = {}) => { // running. let runner = null; + const blastFullCache = !mocha.options.parallel; + // true if a file has changed during a test run let rerunScheduled = false; const run = async () => { try { mocha = beforeRun ? (await beforeRun({mocha, watcher})) || mocha : mocha; - const blastFullCache = !mocha.options.parallel; runner = mocha.run(() => { debug('finished watch run'); runner = null;