Skip to content

Commit db9b38f

Browse files
author
paulgo
committed
Change modulessReset to be called before each cover function rather than immediately after
1 parent 1ba9d34 commit db9b38f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

core/Run.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,16 @@ namespace Moduless
199199
return false;
200200

201201
for (const [coverName, coverFunction] of coverEntries)
202-
await runSingleCover(coverNamespace, coverName, coverFunction);
202+
{
203+
await maybeRunEnvironmentReset(coverNamespace);
204+
await runSingleCover(coverName, coverFunction);
205+
}
203206

204207
return true;
205208
}
206209

207210
/** */
208211
export async function runSingleCover(
209-
coverNamespace: Namespace,
210212
coverName: string,
211213
coverFunction: CoverFn)
212214
{
@@ -260,8 +262,6 @@ namespace Moduless
260262
else if (isAsyncGenerator(coverResult))
261263
for await (const checkerFn of coverResult)
262264
await execCheckerAsync(coverFunctionName, checkerFn);
263-
264-
await maybeRunEnvironmentReset(coverNamespace);
265265
}
266266

267267
/** */

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55

66
## Environment Reset
77

8-
Cover namespaces may export a function called `modulessReset`. If this function exists, it will be called at the end of the execution of every cover function in the cover namespace (whether the function passes or fails) in order to reset the environment for the next cover function.
8+
Cover namespaces may export a function called `modulessReset`. If this function exists, it will be called at the end of the execution of every cover function in the cover namespace (whether the function passes or fails) in order to reset the environment for the next cover function. This function is only called when running multiple cover functions in a series.

0 commit comments

Comments
 (0)