supercov 4.29.11 → 4.29.12

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.
package/docs/cli.md CHANGED
@@ -507,7 +507,10 @@ many more). `mutants` then shows each mutant's verdict beside its weak status,
507
507
  and the mutation score with the verdicts' counts; `mutants --status survived`
508
508
  (or `killed`, `timeout`, `no-coverage`, `error`, `unviable`) lists the mutants
509
509
  with that verdict, and `--format markdown` lists the survivors under the
510
- mutation score.
510
+ mutation score. A Playwright mutant with many candidates that lived through
511
+ its first tier, with the rest of its candidates not run yet, is
512
+ `survived-so-far`: listed by `--status survived` as such (and alone by
513
+ `--status survived-so-far`), counted apart, and not in the score.
511
514
 
512
515
  It runs far less than StrykerJS: no dry run (the measured run is one), no
513
516
  mutant no test infected (decided `survived`) or reached (`no-coverage`), and
@@ -1019,7 +1022,9 @@ pass in the run is listed regardless.
1019
1022
  per line, for a runner's filter. A Vitest, Playwright or node:test test inside
1020
1023
  `describe` blocks is printed as the blocks and the test joined by spaces
1021
1024
  (`small charges`), which is what `vitest -t`, `--grep` and
1022
- `--test-name-pattern` match. `--kind`, `--runner`, `--tag`, `--title` and
1025
+ `--test-name-pattern` match. A Rust test is printed as its path in its crate
1026
+ (`tests::it_works`), which `cargo test -- --exact` and nextest's `test(=...)`
1027
+ match. `--kind`, `--runner`, `--tag`, `--title` and
1023
1028
  `--test-file` list only the affected tests they pick: from a run that merged two
1024
1029
  runners' suites, `tests affected --names --runner playwright` gives Playwright
1025
1030
  only its own tests. A helper beside the tests, or source outside what is
@@ -1032,6 +1037,20 @@ A source file
1032
1037
  added since the run is outside every test's record; the working-tree check
1033
1038
  says so, and the suite should run in full.
1034
1039
 
1040
+ A Rust test loads what it names by path: a fixture, a data file or a script
1041
+ named in its own function (or in its entry of a macro that declares a test
1042
+ per entry), or anywhere in its file outside another test, and what a script it
1043
+ names imports and names in turn. A path that goes on in a placeholder
1044
+ (`tests/fixtures/{name}`) names the directory before it. So a change to one
1045
+ fixture affects the tests that name it, and a file no test names, as before,
1046
+ affects every test. A file measured Rust source embeds with `include_str!` or
1047
+ `include_bytes!` is part of the declaration embedding it: a template or a
1048
+ script compiled into the binary affects the tests that ran that code. Changed
1049
+ code no probe of the run measured -- code for another platform, a feature the
1050
+ run's build left off -- is listed under `unmeasured` (`--json`) and named in
1051
+ the text: no test's record says what it reaches, so run the suite in full
1052
+ where that code is compiled.
1053
+
1035
1054
  A server the suite starts is recorded too: a mock server `webServer` starts,
1036
1055
  or the application's own. Each Node process of a Playwright run notes the
1037
1056
  project files it loads and reads, and the tests it serves, by the test a
package/docs/mutation.md CHANGED
@@ -152,6 +152,12 @@ mutants the tests let survive.
152
152
  that passed did. The candidates are kept as verdicts are, after an edit, a
153
153
  merge and in a later round: a candidate a change could reach runs again.
154
154
  The Playwright driver records them.
155
+ - **A first tier.** A Playwright mutant with more candidates than its first
156
+ tier holds (32, or more where the run's kills come later) runs against
157
+ that tier first, every such mutant before any runs the rest. One the tier
158
+ lets live is `survived-so-far` until the rest runs, in the same pass where
159
+ it has the time: listed with the survivors as such, never in the score
160
+ (`docs/design/strong-mutation.md`, A first tier, then the rest).
155
161
  - **Exit codes.** `0` with an answer; `1` when `--fail-on` or `--critical`
156
162
  finds a mutant; `2`, after the answer, when the measured command failed (a
157
163
  failing test kills nothing, so the verdicts cannot gate) or no mutant could
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supercov",
3
- "version": "4.29.11",
3
+ "version": "4.29.12",
4
4
  "description": "Coverage, security and code quality for coding agents",
5
5
  "keywords": [
6
6
  "coverage",
@@ -125,14 +125,14 @@
125
125
  "test:windows-tls": "node scripts/windows-tls-test.mjs"
126
126
  },
127
127
  "optionalDependencies": {
128
- "@supercov/cli-darwin-arm64": "4.29.11",
129
- "@supercov/cli-darwin-x64": "4.29.11",
130
- "@supercov/cli-linux-arm64-gnu": "4.29.11",
131
- "@supercov/cli-linux-arm64-musl": "4.29.11",
132
- "@supercov/cli-linux-x64-gnu": "4.29.11",
133
- "@supercov/cli-linux-x64-musl": "4.29.11",
134
- "@supercov/cli-win32-arm64": "4.29.11",
135
- "@supercov/cli-win32-x64": "4.29.11"
128
+ "@supercov/cli-darwin-arm64": "4.29.12",
129
+ "@supercov/cli-darwin-x64": "4.29.12",
130
+ "@supercov/cli-linux-arm64-gnu": "4.29.12",
131
+ "@supercov/cli-linux-arm64-musl": "4.29.12",
132
+ "@supercov/cli-linux-x64-gnu": "4.29.12",
133
+ "@supercov/cli-linux-x64-musl": "4.29.12",
134
+ "@supercov/cli-win32-arm64": "4.29.12",
135
+ "@supercov/cli-win32-x64": "4.29.12"
136
136
  },
137
137
  "peerDependencies": {
138
138
  "@playwright/test": ">=1.55.0",
@@ -30,10 +30,10 @@
30
30
  // The attempt's mutant goes into its scope, which reaches the app's server
31
31
  // with every request (header, cookies, child processes) and the page through
32
32
  // an init script. A mutant the server must start with (its code ran in work
33
- // no request named, or is a server module's top level, or ran for a request
34
- // that named no test, or its switch is evaluated as a server module loads)
35
- // is run alone afterwards, in an invocation of its own
36
- // with SUPERCOV_ACTIVE_MUTANT set, which the engine starts for each `restart`
33
+ // no request named or waited for, or is a server module's top level, or ran
34
+ // for a request that named no test, or its switch is evaluated as a server
35
+ // module loads) is run alone afterwards, in an invocation of its own with
36
+ // SUPERCOV_ACTIVE_MUTANT set, which the engine starts for each `restart`
37
37
  // record the judge writes (javascript_run.rs). So do a kill (or a timeout)
38
38
  // that ran beside another mutant's attempt or whose control failed (one test
39
39
  // at a time), and the mutants one invocation had no room for.
@@ -1497,7 +1497,7 @@ function surviveIfDone(pass, id) {
1497
1497
  }
1498
1498
 
1499
1499
  export const WHY = {
1500
- "background": "its code ran in server work no request named",
1500
+ "background": "its code ran in server work no request was waiting for",
1501
1501
  "module-level": "it is a server module's top-level code",
1502
1502
  "by-time": "its code ran for a request that named no test",
1503
1503
  "unfinished": "not every candidate test ran in the shared pass",
@@ -322,6 +322,37 @@ var _a6;
322
322
  var serverPhaseStorage = (_a6 = serverPhaseStorages.get(runtimeInstance)) != null ? _a6 : createServerPhaseStorage();
323
323
  if (serverPhaseStorage)
324
324
  serverPhaseStorages.set(runtimeInstance, serverPhaseStorage);
325
+ // A request's work, until its response has finished: what an attempt's
326
+ // request set off and left running after it was answered -- a promise no one
327
+ // awaits, a poller a first request started that later requests' work runs
328
+ // in -- keeps the request's context, and ran as that test's long after the
329
+ // test, or any request of it, waited for it. Such work is no test's: it is
330
+ // recorded as work no request named, and a strong pass switches no
331
+ // request's mutant on there, so it runs with the server started with it
332
+ // (docs/design/strong-mutation.md). A context carries its request's
333
+ // lifetime under this key, which spreads copy and JSON leaves out.
334
+ var REQUEST_LIFETIME = Symbol.for("supercov.requestLifetime");
335
+ function answered(context) {
336
+ const lifetime = context[REQUEST_LIFETIME];
337
+ return lifetime !== void 0 && lifetime.answered;
338
+ }
339
+ // The request's lifetime, made by whichever copy of the runtime sees the
340
+ // request first. It ends once the response has finished (or its connection
341
+ // closed) and the listeners of that event have run: what they start goes
342
+ // on after it, and is no longer the request's.
343
+ function requestLifetime(request, response) {
344
+ let lifetime = request[REQUEST_LIFETIME];
345
+ if (lifetime !== void 0)
346
+ return lifetime;
347
+ lifetime = { answered: false };
348
+ Object.defineProperty(request, REQUEST_LIFETIME, { __proto__: null, value: lifetime, configurable: true });
349
+ const answer = () => queueMicrotask(() => {
350
+ lifetime.answered = true;
351
+ });
352
+ for (const event of ["finish", "close"])
353
+ response.once(event, answer);
354
+ return lifetime;
355
+ }
325
356
  function probeV2ContextKey(context) {
326
357
  var _a8, _b;
327
358
  const phase = (_a8 = context.phaseId) != null ? _a8 : "unscoped";
@@ -366,13 +397,18 @@ function activateProbeV2Key(key, force = false) {
366
397
  // The async hook activates the current request's context before every
367
398
  // callback the server runs, and building its key and looking it up was most of
368
399
  // a Next server's time in the hook. A request's context object is never
369
- // changed once made, and its key is made of it alone, so each keeps the epoch
370
- // it was given until the epochs are cleared.
400
+ // changed once made but for its request's lifetime, and its key is made of it
401
+ // alone, so each keeps the epoch it was given until the epochs are cleared or
402
+ // its request is answered.
371
403
  // Every copy of the runtime in a process shares one state, and the hook is the
372
404
  // first copy's, so the cache and its generation live on that state too: a
373
405
  // reset from another copy has to reach them.
374
406
  var emptyProbeV2Context = Object.freeze({});
375
407
  function activateProbeV2Context(context) {
408
+ // What a request left running after its answer is no request's: only its
409
+ // lifetime changes once the context is made, and is looked at first.
410
+ if (answered(context))
411
+ context = emptyProbeV2Context;
376
412
  // Work no request owns is keyed by the test running when it runs, which
377
413
  // changes under the same context: only a request's context keeps its epoch.
378
414
  if (!context.scope)
@@ -1449,7 +1485,7 @@ function appendServer(record) {
1449
1485
  // Work done while handling a request that named no test -- a webhook a
1450
1486
  // mock server sends -- says so, with the request's number.
1451
1487
  const stored = serverPhaseStorage == null ? void 0 : serverPhaseStorage.getStore();
1452
- const unscopedRequest = !scope && stored && stored.request ? { request: stored.request } : {};
1488
+ const unscopedRequest = !scope && stored && stored.request && !answered(stored) ? { request: stored.request } : {};
1453
1489
  const serialized = __spreadValues(__spreadValues(__spreadValues({}, record), scope ? { scope } : {}), unscopedRequest);
1454
1490
  if (scope && state.bufferedAttempts.has(attemptKey(scope))) {
1455
1491
  const key = attemptKey(scope);
@@ -1500,7 +1536,7 @@ function environmentRequestContext() {
1500
1536
  function currentRequestContext() {
1501
1537
  const stored = serverPhaseStorage == null ? void 0 : serverPhaseStorage.getStore();
1502
1538
  if (stored !== void 0) {
1503
- if (stored.scope || stored.phaseId)
1539
+ if ((stored.scope || stored.phaseId) && !answered(stored))
1504
1540
  return stored;
1505
1541
  return runtimeGlobal.__SUPERCOV_ACTIVE_SCOPE__ ? { scope: runtimeGlobal.__SUPERCOV_ACTIVE_SCOPE__ } : {};
1506
1542
  }
@@ -1519,15 +1555,15 @@ function activateCoverageScope(scope) {
1519
1555
  }
1520
1556
  function coverageCarrier() {
1521
1557
  const context = currentRequestContext();
1522
- return __spreadValues(__spreadValues({
1558
+ return __spreadValues(__spreadValues(__spreadValues({
1523
1559
  version: 1
1524
- }, context.scope ? { scope: context.scope } : {}), context.phaseId ? { phaseId: context.phaseId } : {});
1560
+ }, context.scope ? { scope: context.scope } : {}), context.phaseId ? { phaseId: context.phaseId } : {}), context[REQUEST_LIFETIME] ? { [REQUEST_LIFETIME]: context[REQUEST_LIFETIME] } : {});
1525
1561
  }
1526
1562
  function withCoverageCarrier(carrier, callback) {
1527
1563
  const decoded = typeof carrier === "string" ? decodeCoverageCarrier(carrier) : carrier;
1528
1564
  if (!serverPhaseStorage || !decoded)
1529
1565
  return callback();
1530
- const context = __spreadValues(__spreadValues({}, decoded.scope ? { scope: decoded.scope } : {}), decoded.phaseId ? { phaseId: decoded.phaseId } : {});
1566
+ const context = __spreadValues(__spreadValues(__spreadValues({}, decoded.scope ? { scope: decoded.scope } : {}), decoded.phaseId ? { phaseId: decoded.phaseId } : {}), decoded[REQUEST_LIFETIME] ? { [REQUEST_LIFETIME]: decoded[REQUEST_LIFETIME] } : {});
1531
1567
  return serverPhaseStorage.run(context, () => withProbeV2Context(context, callback));
1532
1568
  }
1533
1569
  function assertionPhaseState(scope) {
@@ -2129,6 +2165,9 @@ function installNodeRequestPropagation() {
2129
2165
  // the report credits its work to the test running when it came.
2130
2166
  if (incoming && serverPhaseStorage && !(context && (context.scope || context.phaseId)))
2131
2167
  context = { request: nextUnscopedRequest() };
2168
+ // Until its response has finished.
2169
+ if (incoming && context && request && typeof request === "object" && response && typeof response.once === "function")
2170
+ context = __spreadValues(__spreadValues({}, context), { [REQUEST_LIFETIME]: requestLifetime(request, response) });
2132
2171
  // Node emits a request's body and its response's events outside the
2133
2172
  // handler's context, so a handler that reads the body -- `req.on('end')`
2134
2173
  // -- ran as no test's. The request and response carry it with them.
@@ -2188,6 +2227,9 @@ function withRequestPhase(handler, event) {
2188
2227
  const context = __spreadValues(__spreadValues({}, ((_a8 = requestContext == null ? void 0 : requestContext.scope) != null ? _a8 : inheritedContext.scope) ? { scope: (_b = requestContext == null ? void 0 : requestContext.scope) != null ? _b : inheritedContext.scope } : {}), ((_c = requestContext == null ? void 0 : requestContext.phaseId) != null ? _c : inheritedContext.phaseId) ? { phaseId: (_d = requestContext == null ? void 0 : requestContext.phaseId) != null ? _d : inheritedContext.phaseId } : {});
2189
2228
  if (requestContext !== void 0 && !context.scope)
2190
2229
  context.request = nextUnscopedRequest();
2230
+ const lifetime = requestContext !== void 0 ? args.map((argument) => argument && typeof argument === "object" ? argument[REQUEST_LIFETIME] : void 0).find((found) => found !== void 0) : void 0;
2231
+ if (lifetime !== void 0)
2232
+ context[REQUEST_LIFETIME] = lifetime;
2191
2233
  const invoke = () => {
2192
2234
  if (event === "connection" && context.scope && args[0] &&
2193
2235
  typeof args[0] === "object" && typeof args[0].emit === "function")