Skip to content

Commit

Permalink
Fix reruns of test in scripts
Browse files Browse the repository at this point in the history
This is a mocha caching and cleanup issue addressed here: mochajs/mocha#2783.

Relates to #1720
  • Loading branch information
kanej committed Dec 8, 2021
1 parent 6e5a6cb commit 8de63c1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/hardhat-core/src/builtin-tasks/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,16 @@ subtask(TASK_TEST_RUN_MOCHA_TESTS)
const mocha = new Mocha(config.mocha);
testFiles.forEach((file) => mocha.addFile(file));

// @ts-expect-error
mocha.cleanReferencesAfterRun(false);

const testFailures = await new Promise<number>((resolve) => {
mocha.run(resolve);
});

// @ts-expect-error
mocha.dispose();

return testFailures;
});

Expand Down

0 comments on commit 8de63c1

Please sign in to comment.