Skip to content

Commit 8677483

Browse files
author
paulgo
committed
Allow the moduless reset function to return a promise
1 parent 4a1f061 commit 8677483

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

core/Run.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ namespace Moduless
261261
for await (const checkerFn of coverResult)
262262
await execCheckerAsync(coverFunctionName, checkerFn);
263263

264-
maybeRunEnvironmentReset(coverNamespace);
264+
await maybeRunEnvironmentReset(coverNamespace);
265265
}
266266

267267
/** */
@@ -340,12 +340,15 @@ namespace Moduless
340340
* and runs this function if it exists. The environment reset function needs to
341341
* be named "modulessReset"
342342
*/
343-
function maybeRunEnvironmentReset(ns: Namespace)
343+
async function maybeRunEnvironmentReset(ns: Namespace)
344344
{
345345
const resetFn = ns["modulessReset"] as Function;
346346
if (typeof resetFn !== "function")
347347
return;
348348

349-
resetFn();
349+
const result = resetFn();
350+
if (result instanceof Promise)
351+
await result;
352+
350353
}
351354
}

0 commit comments

Comments
 (0)