supercov 4.28.0 → 4.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +43 -16
  2. package/docs/cli.md +322 -2
  3. package/docs/getting-started.md +18 -0
  4. package/docs/mutation.md +539 -0
  5. package/docs/supported-suites.md +109 -60
  6. package/package.json +11 -10
  7. package/runtime/javascript/atomic.mjs +6 -2
  8. package/runtime/javascript/ava.mjs +12 -0
  9. package/runtime/javascript/bunTest.mjs +17 -0
  10. package/runtime/javascript/jest.cjs +67 -0
  11. package/runtime/javascript/jest.config.mjs +46 -6
  12. package/runtime/javascript/jestReporter.mjs +5 -2
  13. package/runtime/javascript/mocha.mjs +79 -5
  14. package/runtime/javascript/nodeTest.mjs +28 -0
  15. package/runtime/javascript/playwright.mjs +33 -0
  16. package/runtime/javascript/playwrightStrong.mjs +477 -0
  17. package/runtime/javascript/playwrightStrongReporter.mjs +377 -0
  18. package/runtime/javascript/runnerEntry.mjs +62 -0
  19. package/runtime/javascript/runtime.mjs +752 -13
  20. package/runtime/javascript/snapshots.mjs +16 -1
  21. package/runtime/javascript/strongJestHost.mjs +103 -0
  22. package/runtime/javascript/strongJob.mjs +78 -0
  23. package/runtime/javascript/strongJobs.mjs +809 -0
  24. package/runtime/javascript/strongMochaHost.mjs +166 -0
  25. package/runtime/javascript/strongWasmOut.cjs +96 -0
  26. package/runtime/javascript/tap.mjs +43 -1
  27. package/runtime/javascript/transport.mjs +5 -0
  28. package/runtime/javascript/vitest.mjs +74 -2
  29. package/runtime/javascript/vitestBrowser.mjs +34 -2
  30. package/runtime/javascript/vitestStrong.mjs +234 -0
  31. package/runtime/javascript/vitestStrongReporter.mjs +2268 -0
  32. package/runtime/javascript/vitestStrongSpawner.mjs +248 -0
@@ -0,0 +1,377 @@
1
+ // Strong mutation's reporter for Playwright (playwrightStrong.mjs explains the
2
+ // pass). In the runner process it maps each repetition of a test to the test
3
+ // the plan names, marks each test's baseline and each killed mutant as
4
+ // results come (the fixture reads them: a repetition after a failed baseline
5
+ // or a kill skips), and at the end turns the repetitions' outcomes into each
6
+ // mutant's verdict, in the results file `mutants test` reads.
7
+ import { appendFileSync, existsSync, readFileSync } from "node:fs";
8
+ import { baselineOf, key, loadRows, strongPass, writeJson } from "./playwrightStrong.mjs";
9
+
10
+ const WHY = {
11
+ "background": "its code ran in server work no request named",
12
+ "module-level": "it is a server module's top-level code",
13
+ "by-time": "its code ran for a request that named no test",
14
+ "timeout-retry": "a test ran out of time with it switched on, and ran again alone with twice the time",
15
+ "canary": "a canary failed in the server it shared",
16
+ "unfinished": "not every candidate test ran in the shared pass",
17
+ "confirm": "a test killed it beside other mutants' attempts",
18
+ "stage": "its likeliest killer let it live",
19
+ "rest": "its first test let it live, and its other candidates ran one at a time",
20
+ };
21
+ // Outcomes that ended this long before a pass's first error outside any
22
+ // test (a server that exited) are trusted; later ones may be its doing.
23
+ const ERROR_MARGIN_MS = 1_000;
24
+
25
+ function readLines(path) {
26
+ if (!existsSync(path))
27
+ return [];
28
+ return readFileSync(path, "utf8")
29
+ .split("\n")
30
+ .filter((line) => line.trim())
31
+ .flatMap((line) => {
32
+ try {
33
+ return [JSON.parse(line)];
34
+ }
35
+ catch {
36
+ return [];
37
+ }
38
+ });
39
+ }
40
+
41
+ export default class SupercovPlaywrightStrongReporter {
42
+ constructor() {
43
+ this.pass = strongPass();
44
+ this.started = Date.now();
45
+ this.statuses = new Map();
46
+ this.repetitions = {};
47
+ this.byOriginal = new Map();
48
+ }
49
+ // It prints nothing, and says it prints: Playwright adds a reporter of
50
+ // its own where none does, and `mutants test --json` owns stdout.
51
+ printsToStdio() {
52
+ return true;
53
+ }
54
+ onBegin(_config, suite) {
55
+ if (!this.pass)
56
+ return;
57
+ this.rows = loadRows(this.pass);
58
+ // A repetition of a test has an id of its own; the plan names the
59
+ // first. Repetitions share the test's project, file and titles.
60
+ const where = (test) => JSON.stringify(test.titlePath());
61
+ const firsts = new Map();
62
+ const all = suite.allTests();
63
+ for (const test of all) {
64
+ if (!test.repeatEachIndex)
65
+ firsts.set(where(test), test.id);
66
+ }
67
+ for (const test of all) {
68
+ const original = test.repeatEachIndex ? firsts.get(where(test)) : test.id;
69
+ if (!original)
70
+ continue;
71
+ this.repetitions[test.id] = original;
72
+ this.byOriginal.set(`${original}\0${test.repeatEachIndex}`, test.id);
73
+ }
74
+ writeJson(`${this.pass.round}/repetitions.json`, this.repetitions);
75
+ }
76
+ rowOf(test) {
77
+ const original = this.repetitions[test.id];
78
+ const file = original && this.rows.tests[original]?.file;
79
+ const row = file && this.rows.files[file]?.[test.repeatEachIndex];
80
+ return row && row.tests.includes(original) ? { row, original } : undefined;
81
+ }
82
+ attempt(repetition) {
83
+ const path = `${this.pass.round}/attempts/${key(repetition)}.json`;
84
+ try {
85
+ return JSON.parse(readFileSync(path, "utf8"));
86
+ }
87
+ catch {
88
+ return undefined;
89
+ }
90
+ }
91
+ onError(error) {
92
+ // Outside any test: a web server that exited, a global setup that
93
+ // threw. The first one's time and words.
94
+ this.globalError ??= { at: Date.now(), message: firstWords(error?.message ?? error) };
95
+ }
96
+ onTestEnd(test, result) {
97
+ if (!this.pass)
98
+ return;
99
+ // Why it failed, and whether only the test's time ran out: a test
100
+ // that timed out while an assertion or an action was failing failed
101
+ // on its own.
102
+ const errors = result.errors ?? [];
103
+ const timeoutOnly = errors.length > 0 && errors.every((error) => TEST_TIMEOUT.test(stripAnsi(error?.message ?? "")));
104
+ const reported = errors.find((error) => !TEST_TIMEOUT.test(stripAnsi(error?.message ?? ""))) ?? errors[0];
105
+ this.statuses.set(test.id, {
106
+ status: result.status,
107
+ timeoutOnly,
108
+ message: reported ? firstWords(reported.message ?? reported.value) : undefined,
109
+ });
110
+ const found = this.rowOf(test);
111
+ if (!found)
112
+ return;
113
+ const { row, original } = found;
114
+ if (row.kind === "baseline" && !this.rows.job) {
115
+ writeJson(`${this.pass.round}/baseline/${key(original)}`, result.status === "passed" ? "passed" : "failed");
116
+ return;
117
+ }
118
+ // The rest of the mutant's repetitions skip.
119
+ if (row.kind === "mutant" && result.status === "failed" && this.attempt(test.id))
120
+ writeJson(`${this.pass.round}/killed/${key(row.id)}`, original);
121
+ }
122
+ onEnd() {
123
+ if (!this.pass)
124
+ return;
125
+ this.finish();
126
+ // A killed mutant fails its test, and that is the point: the
127
+ // command's outcome is the pass's, not the tests'.
128
+ return { status: "passed" };
129
+ }
130
+ finish() {
131
+ const { pass, rows } = this;
132
+ const kind = rows.kind;
133
+ const write = (record) => appendFileSync(pass.resultsPath, `${JSON.stringify(record)}\n`);
134
+ for (const record of rows.immediate)
135
+ write(record);
136
+ // Where a mutant ran past its hit limit, by attempt; and in a process
137
+ // that had it on everywhere, by mutant alone.
138
+ const timedOut = new Set();
139
+ const timedOutAnywhere = new Set();
140
+ for (const line of readLines(`${pass.resultsPath}.timeouts.jsonl`)) {
141
+ if (line.pass !== (pass.restart ?? "main"))
142
+ continue;
143
+ if (line.attemptId)
144
+ timedOut.add(line.attemptId);
145
+ else
146
+ timedOutAnywhere.add(line.mutant);
147
+ }
148
+ const baselineFailed = new Set();
149
+ if (!rows.job) {
150
+ for (const fileRows of Object.values(rows.files)) {
151
+ for (const original of fileRows[0].tests) {
152
+ if (baselineOf(pass, original) !== "passed")
153
+ baselineFailed.add(original);
154
+ }
155
+ }
156
+ }
157
+ // Every attempt that ran with a mutant: a kill beside another's is
158
+ // confirmed alone before it counts.
159
+ const mutated = [];
160
+ for (const repetition of Object.keys(this.repetitions)) {
161
+ const attempt = this.attempt(repetition);
162
+ if (attempt && attempt.mutant !== "-")
163
+ mutated.push({ ...attempt, repetition, endedAt: attempt.endedAt ?? Date.now() });
164
+ }
165
+ const beside = (repetition, attempt) => mutated.some((other) => other.repetition !== repetition &&
166
+ other.mutant !== attempt.mutant &&
167
+ other.startedAt < (attempt.endedAt ?? Date.now()) &&
168
+ attempt.startedAt < other.endedAt);
169
+ // Each repetition's outcome.
170
+ const outcomeOf = (original, index, mutant) => {
171
+ const repetition = this.byOriginal.get(`${original}\0${index}`);
172
+ const ended = repetition && this.statuses.get(repetition);
173
+ const attempt = repetition && this.attempt(repetition);
174
+ if (!attempt) {
175
+ if (baselineFailed.has(original))
176
+ return { kind: "baseline-failed" };
177
+ return { kind: "unrun" };
178
+ }
179
+ const ranAway = attempt.pageTimeout === true ||
180
+ (attempt.attemptId && timedOut.has(attempt.attemptId)) ||
181
+ (mutant && timedOutAnywhere.has(mutant));
182
+ const base = {
183
+ startedAt: attempt.startedAt,
184
+ endedAt: attempt.endedAt ?? Date.now(),
185
+ message: ended?.message,
186
+ beside: beside(repetition, attempt),
187
+ };
188
+ if (ranAway)
189
+ return { ...base, kind: "hit-limit" };
190
+ if (ended?.status === "passed")
191
+ return { ...base, kind: "passed" };
192
+ if (ended?.status === "timedOut" && ended.timeoutOnly)
193
+ return { ...base, kind: "timed-out" };
194
+ if (ended?.status === "failed" || ended?.status === "interrupted" || ended?.status === "timedOut")
195
+ return { ...base, kind: "failed" };
196
+ return { kind: "unrun" };
197
+ };
198
+ // Each mutant's repetitions, in every file it has a row in, and the
199
+ // canaries'.
200
+ const outcomes = new Map();
201
+ const canaries = [];
202
+ for (const fileRows of Object.values(rows.files)) {
203
+ fileRows.forEach((row, index) => {
204
+ if (row.kind === "baseline")
205
+ return;
206
+ for (const original of row.tests) {
207
+ const outcome = { test: original, ...outcomeOf(original, index, row.mutant) };
208
+ if (row.kind === "canary") {
209
+ canaries.push(outcome);
210
+ continue;
211
+ }
212
+ if (!outcomes.has(row.id))
213
+ outcomes.set(row.id, []);
214
+ outcomes.get(row.id).push(outcome);
215
+ }
216
+ });
217
+ }
218
+ // What runs next: one mutant alone (with the server started with
219
+ // it, where a server ran its code outside any request), a further
220
+ // pass of survivors' other candidates, and a serial pass, one test
221
+ // at a time, for kills to confirm, timeouts' second tries and what
222
+ // did not finish.
223
+ const alone = [];
224
+ const stage = [];
225
+ const serial = [];
226
+ const next = (entry, reason, tests, budgetFactor = 1, later = []) => {
227
+ const runnable = tests.filter((test) => !baselineFailed.has(test));
228
+ const rest = later.filter((test) => !baselineFailed.has(test));
229
+ if (!runnable.length && !rest.length) {
230
+ write({ id: entry.id, status: "error", reason: "its candidate tests fail without any mutant", tests: 0, durationMs: 0 });
231
+ return;
232
+ }
233
+ const job = runnable.length
234
+ ? { id: entry.id, mutant: entry.mutant, tests: runnable, rest, reason, budgetFactor }
235
+ : { id: entry.id, mutant: entry.mutant, tests: rest, rest: [], reason, budgetFactor };
236
+ if (EVERYWHERE.includes(reason) || reason === "canary")
237
+ alone.push(job);
238
+ else if (reason === "stage")
239
+ stage.push(job);
240
+ else
241
+ serial.push(job);
242
+ };
243
+ const failedCanaries = canaries.filter((canary) => ["failed", "timed-out", "hit-limit"].includes(canary.kind));
244
+ const doubtUntil = failedCanaries.length
245
+ ? Math.max(...failedCanaries.map((canary) => canary.endedAt))
246
+ : -Infinity;
247
+ // After an error outside any test (the shared server exited), what
248
+ // ended later may be its doing.
249
+ const trustedUntil = this.globalError ? this.globalError.at - ERROR_MARGIN_MS : Infinity;
250
+ let decided = 0;
251
+ let confirming = 0;
252
+ for (const [id, entry] of Object.entries(rows.entries)) {
253
+ const own = outcomes.get(id) ?? [];
254
+ const ran = own.filter((outcome) => outcome.startedAt !== undefined);
255
+ const all = [...entry.tests, ...(entry.rest ?? [])];
256
+ if (kind === "main" && ran.some((outcome) => outcome.startedAt <= doubtUntil)) {
257
+ next(entry, "canary", all);
258
+ continue;
259
+ }
260
+ const verdict = this.verdict(entry, own, all, trustedUntil, next);
261
+ if (verdict === "confirm")
262
+ confirming += 1;
263
+ if (!verdict || verdict === "confirm")
264
+ continue;
265
+ decided += 1;
266
+ const durationMs = ran.length
267
+ ? Math.max(...ran.map((outcome) => outcome.endedAt)) - Math.min(...ran.map((outcome) => outcome.startedAt))
268
+ : 0;
269
+ write({ id, ...verdict, tests: ran.length, durationMs });
270
+ }
271
+ for (const job of rows.restarts)
272
+ next(job, job.reason, job.tests);
273
+ // A serial pass that decided nothing would only ask for its
274
+ // unfinished mutants again.
275
+ if (kind === "serial" && !decided) {
276
+ for (const job of serial.filter((job) => job.reason === "unfinished"))
277
+ write({ id: job.id, status: "error", reason: "its tests did not finish, run one at a time", tests: 0, durationMs: 0 });
278
+ serial.splice(0, serial.length, ...serial.filter((job) => job.reason !== "unfinished"));
279
+ }
280
+ for (const job of alone)
281
+ write({ restart: { kind: "alone", everywhere: EVERYWHERE.includes(job.reason), reason: job.reason, mutants: [job], otherRunners: rows.otherRunners } });
282
+ if (stage.length)
283
+ write({ restart: { kind: "stage", reason: "stage", mutants: stage, otherRunners: rows.otherRunners } });
284
+ if (serial.length)
285
+ write({ restart: { kind: "serial", reason: [...new Set(serial.map((job) => job.reason))].join(", "), mutants: serial, otherRunners: rows.otherRunners } });
286
+ write({
287
+ summary: true,
288
+ runner: "playwright",
289
+ pass: pass.name,
290
+ kind,
291
+ ...(rows.concurrency.workers ? { workers: rows.concurrency.workers } : {}),
292
+ serialFiles: rows.concurrency.serialFiles.length,
293
+ ...(this.globalError ? { error: this.globalError.message } : {}),
294
+ durationMs: Date.now() - this.started,
295
+ decided,
296
+ confirming,
297
+ next: { alone: alone.length, stage: stage.length, serial: serial.length },
298
+ canaries: {
299
+ ran: canaries.filter((canary) => canary.startedAt !== undefined).length,
300
+ failed: failedCanaries.map((canary) => canary.test),
301
+ },
302
+ });
303
+ }
304
+ /**
305
+ * A mutant's verdict from its repetitions in this pass; `undefined` when
306
+ * it was sent on to another pass, `"confirm"` when a kill beside other
307
+ * mutants' attempts is to be confirmed one test at a time.
308
+ */
309
+ verdict(entry, outcomes, all, trustedUntil, next) {
310
+ const { rows } = this;
311
+ const kind = rows.kind;
312
+ const shared = kind === "main" || kind === "stage";
313
+ const reason = entry.reason ?? (kind === "main" ? undefined : rows.job?.reason);
314
+ const after = kind === "alone"
315
+ ? `; ran alone${EVERYWHERE.includes(reason) ? ", with the server started with it switched on" : ""}: ${WHY[reason] ?? reason}`
316
+ : kind === "serial"
317
+ ? `; ran one test at a time: ${WHY[reason] ?? reason}`
318
+ : "";
319
+ const trusted = (outcome) => !shared || (!outcome.beside && outcome.endedAt < trustedUntil);
320
+ const failed = outcomes.filter((outcome) => outcome.kind === "failed");
321
+ const killer = failed.find(trusted);
322
+ if (killer)
323
+ return { status: "killed", killedBy: killer.test, reason: `${killer.message ?? "the test failed"}${after}` };
324
+ const ranAway = outcomes.find((outcome) => outcome.kind === "hit-limit");
325
+ if (ranAway)
326
+ return { status: "timeout", killedBy: ranAway.test, reason: `evaluated past its hit limit${after}` };
327
+ if (failed.length) {
328
+ // Its killing test ran beside other mutants' attempts (or after
329
+ // the shared server failed): that test first, alone, then the rest.
330
+ const first = failed[0].test;
331
+ next(entry, failed.some((outcome) => outcome.beside) ? "confirm" : "unfinished", [first], 1, all.filter((test) => test !== first));
332
+ return "confirm";
333
+ }
334
+ const slow = outcomes.find((outcome) => outcome.kind === "timed-out");
335
+ if (slow) {
336
+ if (shared) {
337
+ next(entry, "timeout-retry", all, 2);
338
+ return undefined;
339
+ }
340
+ return { status: "timeout", killedBy: slow.test, reason: `ran out of time${after}` };
341
+ }
342
+ const unrun = outcomes.filter((outcome) => outcome.kind === "unrun" || (shared && outcome.endedAt !== undefined && outcome.endedAt >= trustedUntil));
343
+ if (unrun.length) {
344
+ // Alone, the command failed outside any test: the mutant broke the
345
+ // app (a server that would not start with it).
346
+ if (kind === "alone" && this.globalError)
347
+ return { status: "killed", reason: `the command failed with it switched on (${this.globalError.message})${after}` };
348
+ next(entry, "unfinished", all);
349
+ return undefined;
350
+ }
351
+ if (outcomes.length && outcomes.every((outcome) => outcome.kind === "baseline-failed"))
352
+ return { status: "error", reason: "its candidate tests fail without any mutant" };
353
+ // Its likeliest killer let it live: its other candidates next, side
354
+ // by side after the main pass, one at a time after a serial one.
355
+ if (entry.rest?.length && kind !== "stage") {
356
+ next(entry, kind === "main" ? "stage" : "rest", entry.rest);
357
+ return undefined;
358
+ }
359
+ const others = rows.otherRunners[entry.id];
360
+ if (others)
361
+ return { status: "error", reason: `no Playwright test killed it, and its other candidates ran under ${others.join(", ")}, which this pass does not run` };
362
+ return { status: "survived", ...(after ? { reason: after.slice(2) } : {}) };
363
+ }
364
+ }
365
+
366
+ const TEST_TIMEOUT = /Test timeout of \d+ms exceeded/;
367
+ const EVERYWHERE = ["background", "module-level", "by-time"];
368
+
369
+ function stripAnsi(text) {
370
+ return String(text).replace(/\u001b\[[0-9;]*m/g, "");
371
+ }
372
+
373
+ /** An error's message, on one line, short enough to keep. */
374
+ function firstWords(message) {
375
+ const text = stripAnsi(message ?? "").replace(/\s+/g, " ").trim();
376
+ return text.length > 300 ? `${text.slice(0, 299)}…` : text;
377
+ }
@@ -4,6 +4,7 @@
4
4
  // probe a test reaches is counted as background. Node runs this from
5
5
  // register.mjs before the CLI parses argv; Bun loads no Node preload, so its
6
6
  // adapter does instead.
7
+ import { readFileSync } from "node:fs";
7
8
  import { resolve } from "node:path";
8
9
 
9
10
  // A project's own coverage tool measures what runs, and under Supercov that is
@@ -66,6 +67,17 @@ function useGeneratedVitestConfig(entrypoint) {
66
67
  process.env.SUPERCOV_ORIGINAL_VITEST_CONFIG = originalConfig;
67
68
  }
68
69
  process.argv.push("--config", generatedVitestConfig);
70
+ // A strong pass's job runs one test file: Vitest's file filter keeps it
71
+ // from collecting the others (its adapter would skip their tests).
72
+ const job = process.env.SUPERCOV_STRONG_JOB;
73
+ if (job) {
74
+ try {
75
+ process.argv.push(...Object.keys(JSON.parse(readFileSync(job, "utf8")).files ?? {}));
76
+ }
77
+ catch {
78
+ // Without its job the adapter runs every test.
79
+ }
80
+ }
69
81
  if (process.env.SUPERCOV_DEBUG === "1") {
70
82
  console.error("[supercov] Vitest argv configured", {
71
83
  entrypoint,
@@ -78,6 +90,20 @@ function useGeneratedVitestConfig(entrypoint) {
78
90
 
79
91
  /** Adapt the runner whose entry point `entrypoint` is, if any. */
80
92
  export async function adaptRunnerEntry(entrypoint) {
93
+ // A strong pass's job runs one test file: node:test and tap start a
94
+ // process for each of the run's, and those of the others end here,
95
+ // before they load anything.
96
+ if ((process.env.NODE_TEST_CONTEXT || process.env.TAP_CHILD_ID) && process.env.SUPERCOV_STRONG_JOB && entrypoint) {
97
+ const { strongJob } = await import(new URL("./strongJob.mjs", import.meta.url).href);
98
+ if (strongJob()?.runsFile(entrypoint) === false)
99
+ process.exit(0);
100
+ }
101
+ // node:test counts a test file with no test() in it as a test of its
102
+ // own, passing or failing by what its top level asserts. What runs there
103
+ // is that test's. A file that names node:test keeps its top level
104
+ // counting for the run, as it always did.
105
+ if (process.env.NODE_TEST_CONTEXT && process.env.SUPERCOV_EVIDENCE_DIR && entrypoint && !namesNodeTest(entrypoint))
106
+ await recordNodeTestTopLevel(entrypoint);
81
107
  useGeneratedVitestConfig(entrypoint);
82
108
  // The Mocha CLI, the child it forks for Node options, and each --parallel
83
109
  // worker run tests through Mocha's Runner, which the adapter patches before
@@ -106,3 +132,39 @@ export async function adaptRunnerEntry(entrypoint) {
106
132
  await adaptTap(entrypoint);
107
133
  }
108
134
  }
135
+
136
+ // Whether a test file's source names node:test: a file that does not can
137
+ // register no test of its own.
138
+ function namesNodeTest(file) {
139
+ try {
140
+ return /\bnode:test\b|["']test["']/.test(readFileSync(file.startsWith("file:") ? new URL(file) : file, "utf8"));
141
+ }
142
+ catch {
143
+ return true;
144
+ }
145
+ }
146
+
147
+ async function recordNodeTestTopLevel(file) {
148
+ globalThis.__SUPERCOV_DIRECT_RUNTIME__ ??= await import("./runtime.mjs");
149
+ process.__SUPERCOV_DIRECT_RUNTIME__ ??= globalThis.__SUPERCOV_DIRECT_RUNTIME__;
150
+ const runtime = globalThis.__SUPERCOV_DIRECT_RUNTIME__;
151
+ const { runnerExecutionScope, writeRunnerEvidence } = await import(new URL("./runnerEvidence.mjs", import.meta.url).href);
152
+ const identity = { runner: "node:test", file, name: "(top level)" };
153
+ const scope = runnerExecutionScope(identity);
154
+ // From the file's first assertion outside any test on, what runs is the
155
+ // file's test. What ran before it (loading its modules) counts for the
156
+ // run, as in any file; a file that asserts nothing is no test.
157
+ let asserted = false;
158
+ globalThis.__SUPERCOV_UNSCOPED_ASSERTION__ = () => {
159
+ if (asserted || (globalThis[Symbol.for("supercov.nodeTestRegistrations")] ?? 0) > 0)
160
+ return;
161
+ asserted = true;
162
+ runtime.beginBufferedServerEvidence(scope);
163
+ runtime.activateCoverageScope(scope);
164
+ };
165
+ process.once("exit", (code) => {
166
+ if (!asserted)
167
+ return;
168
+ writeRunnerEvidence(identity, code === 0 ? "passed" : "failed", scope, process.env.SUPERCOV_EVIDENCE_DIR, runtime.takeNodeAssertionPhases(scope), runtime.flushBufferedServerEvidence(scope));
169
+ });
170
+ }