supercov 4.8.0 → 4.8.1

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.
@@ -96,16 +96,7 @@ Both are useful:
96
96
 
97
97
  Code that runs while no test is running counts in the run's total and in no
98
98
  test's: a server starting before the first test, modules loading, work between
99
- tests.
100
-
101
- A request to your app server that names no test -- a webhook from a mock
102
- Stripe server Supercov does not measure -- is credited to the test running when
103
- the server handled it, if that test was the only one running then. A mock that
104
- runs under Supercov passes the test's identity on in its own requests, and its
105
- webhook is credited exactly. The run's
106
- `Attribution` line counts those tests as `with server work credited by time`,
107
- and each one's `runs <id> test` page says so. Work done while tests ran at
108
- once, or while none ran, stays no test's. When a run has any, the summary's `By test kind` table ends with a
99
+ tests. When a run has any, the summary's `By test kind` table ends with a
109
100
  `no test` row for what only that covered, which is why a run with one kind of
110
101
  test can show a total above that kind's own:
111
102
 
@@ -119,9 +110,22 @@ By test kind
119
110
  directory has any, so a directory's `All` never stands above its kinds
120
111
  unexplained.
121
112
 
113
+ A request to your app server that names no test -- a webhook from a mock
114
+ Stripe server Supercov does not measure -- is credited to the test running when
115
+ the server handled it, if that test was the only one running then. Where a
116
+ server serves one worker's tests, as a server started per worker does, only
117
+ that worker's tests count, so the request is credited while other workers run
118
+ theirs. A mock that runs under Supercov passes the test's identity on in its
119
+ own requests, and its webhook is credited exactly. The run's `Attribution`
120
+ line counts tests credited by time as `with server work credited by time`, and
121
+ each one's `runs <id> test` page says so. Work done while tests ran at once on
122
+ the same server, or while none ran, stays no test's.
123
+
122
124
  A test that made assertions and has no covered line to its name is counted in
123
125
  a warning on the summary. `npx supercov runs latest tests without-evidence`
124
- lists every such test, with its file, kind and outcome.
126
+ lists every such test, with its file, kind and outcome. Where its file imports
127
+ no measured source, it says so: such a test can only have checked test code,
128
+ mocks or fixtures.
125
129
 
126
130
  See [Supported suites](supported-suites.md) for the attribution available from
127
131
  each runner.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supercov",
3
- "version": "4.8.0",
3
+ "version": "4.8.1",
4
4
  "description": "Coverage, security and code quality for coding agents",
5
5
  "keywords": [
6
6
  "coverage",
@@ -120,14 +120,14 @@
120
120
  "test:windows-tls": "node scripts/windows-tls-test.mjs"
121
121
  },
122
122
  "optionalDependencies": {
123
- "@supercov/cli-darwin-arm64": "4.8.0",
124
- "@supercov/cli-darwin-x64": "4.8.0",
125
- "@supercov/cli-linux-arm64-gnu": "4.8.0",
126
- "@supercov/cli-linux-arm64-musl": "4.8.0",
127
- "@supercov/cli-linux-x64-gnu": "4.8.0",
128
- "@supercov/cli-linux-x64-musl": "4.8.0",
129
- "@supercov/cli-win32-arm64": "4.8.0",
130
- "@supercov/cli-win32-x64": "4.8.0"
123
+ "@supercov/cli-darwin-arm64": "4.8.1",
124
+ "@supercov/cli-darwin-x64": "4.8.1",
125
+ "@supercov/cli-linux-arm64-gnu": "4.8.1",
126
+ "@supercov/cli-linux-arm64-musl": "4.8.1",
127
+ "@supercov/cli-linux-x64-gnu": "4.8.1",
128
+ "@supercov/cli-linux-x64-musl": "4.8.1",
129
+ "@supercov/cli-win32-arm64": "4.8.1",
130
+ "@supercov/cli-win32-x64": "4.8.1"
131
131
  },
132
132
  "peerDependencies": {
133
133
  "@playwright/test": ">=1.55.0",
@@ -467,6 +467,25 @@ function serverRecordKey(record) {
467
467
  const request = record.request ? `request-${record.request}:` : "";
468
468
  return `${request}${(_a8 = record.phaseId) != null ? _a8 : "unscoped"}:${record.type}:${suffix}`;
469
469
  }
470
+ // Notes, once per test attempt, that this process served a request naming
471
+ // it. A request here that names no test is credited by time only among the
472
+ // attempts this process served: with a server per worker, the worker's test,
473
+ // whatever the other workers run meanwhile.
474
+ function noteServedAttempt(scope) {
475
+ if (!state.servedAttempts)
476
+ state.servedAttempts = /* @__PURE__ */ new Set();
477
+ const key = attemptKey(scope);
478
+ if (state.servedAttempts.has(key))
479
+ return;
480
+ state.servedAttempts.add(key);
481
+ const fs = getFs();
482
+ if (!fs)
483
+ return;
484
+ try {
485
+ appendDurableBackgroundRecord(fs, scope.runId, { type: "served", id: scope.attemptId, timestampMs: Date.now() });
486
+ } catch (e) {
487
+ }
488
+ }
470
489
  // Numbers the requests a server handles that name no test.
471
490
  function nextUnscopedRequest() {
472
491
  state.unscopedRequests = (state.unscopedRequests || 0) + 1;
@@ -1400,6 +1419,8 @@ function installNodeRequestPropagation() {
1400
1419
  // the server process were created by a shared before hook.
1401
1420
  const incoming = requestCoverageContext(args[0]);
1402
1421
  if (incoming) context = incoming.scope ? incoming : context != null ? context : currentRequestContext();
1422
+ if (incoming && incoming.scope)
1423
+ noteServedAttempt(incoming.scope);
1403
1424
  // A request that names no test, to a server no test owns, is numbered:
1404
1425
  // the report credits its work to the test running when it came.
1405
1426
  if (incoming && serverPhaseStorage && !(context && (context.scope || context.phaseId)))