supercov 4.20.0 → 4.20.2

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
@@ -923,6 +923,7 @@ terminal or offline environment after the package has been downloaded.
923
923
  | `SUPERCOV_SOURCE_ROOTS` | Comma-separated directories or files that hold your own code, in any language; everything else is left out |
924
924
  | `SUPERCOV_TEST_KIND` | Label the wrapped command as a test level such as `unit` or `e2e` |
925
925
  | `SUPERCOV_SOURCE_TOOLS` | Comma-separated names of tools the test command runs that read source as text, such as a linter or a spell checker, besides Biome, oxlint, dprint, cspell and knip. Each is run on your source as you wrote it instead of on the instrumented copy |
926
+ | `SUPERCOV_RUN_ID` | Set by Supercov, not by you: in every process a measured command starts, the run's id, so a test or harness can tell it is measured |
926
927
  | `SUPERCOV_RUN_ID_FILE` | A file to write the recorded run's id to, for a script to query that run rather than `latest` |
927
928
  | `SUPERCOV_KEEP_WORKSPACE` | Set to `1` to leave the instrumented copy of the project in `.supercov/workspaces/` after the run, to inspect what the command ran |
928
929
 
@@ -274,8 +274,11 @@ of that build is not counted, and wasm-only code is, whatever target
274
274
  `cargo test` builds the rest for. The crate counts whether or not
275
275
  `cargo test` compiles it (`cargo test -p host` does not) and whether or not
276
276
  a test started its Worker, so every run of the workspace has one
277
- denominator. Where no test of a run started a Worker, its files say so, in
278
- `gaps` and the file view, rather than reading as code the tests missed.
277
+ denominator. Where no test of a run started a Worker, its files are not
278
+ measured, rather than read as code the tests missed: they leave the run's
279
+ totals, the file view says why at the top, `scope` lists them as left out,
280
+ the run names them after the tests' output, and `runs check` refuses to judge
281
+ a floor over a run that left them unmeasured.
279
282
 
280
283
  `wrangler dev --remote` runs the Worker on Cloudflare's edge, and wrangler
281
284
  opens no inspector into it there, so nothing can read what it ran. A test
@@ -292,7 +295,11 @@ Worker of a session, and Supercov reads each through workerd's own, whose
292
295
  address a small preload in wrangler's Node process reports. A test that
293
296
  sets its own `NODE_OPTIONS` keeps them; the preload is added after. A workspace with several Worker crates counts each crate
294
297
  once, and runs of different tests -- each starting different Workers, or
295
- none -- merge with `supercov merge`. Tests that run a Worker only when its `build/` exists, as a test
298
+ none -- merge with `supercov merge`. A crate the Worker is built with, such
299
+ as a core library the native tests call too, is measured inside the Worker:
300
+ its probes run in the Worker's wasm and are read with the Worker's, into the
301
+ same file as its native tests, each test credited what it reached either
302
+ way. Tests that run a Worker only when its `build/` exists, as a test
296
303
  kit that will not start an unbuilt Worker does, run it: a `build/` you made
297
304
  beforehand and keep out of git is in the copy, and `wrangler dev` builds the
298
305
  crate with probes over it there.
@@ -308,10 +315,40 @@ What a project needs:
308
315
 
309
316
  The project needs no `cfg` flag or build step of its own for Supercov.
310
317
 
318
+ #### What a test harness can rely on
319
+
320
+ - **Any configuration, anywhere.** A test may write its own wrangler
321
+ configuration, per test, outside the crate, with a `main` of its own: a
322
+ module that loads the built Worker and adds stand-ins or test controls.
323
+ Supercov leaves every configuration as it was written. When a test runs
324
+ `wrangler dev`, Supercov's `wrangler` hands it a copy of the configuration
325
+ it was given (`-c`, or the one wrangler finds from its directory), beside
326
+ the original as `.supercov-wrangler-<pid>-<n>.toml` (or `.json`), whose
327
+ `main` is a small entry that remembers the Worker's wasm instances and then
328
+ loads your `main`. The copy is removed once that `wrangler` exits. A Worker
329
+ is read when wasm built from the crate's measured source runs in it,
330
+ whatever the configuration's `main` imports.
331
+ - **The measured build.** The configuration's `[build]` builds the crate
332
+ with worker-build (any `cwd`), or its `main` imports a build made in the
333
+ run's copy. A `build/` made before the run, without probes, has nothing to
334
+ read. Supercov builds nothing itself: as a JavaScript suite builds the wasm
335
+ it loads, build the Worker in the measured command or in the tests.
336
+ - **Why a Worker was not measured.** Where tests started `wrangler dev` and
337
+ no measured build ran in it, the Worker's files name each `wrangler dev -c
338
+ <path>` the tests started, and why a configuration was left as it was (no
339
+ `main`, say), in the file view, `scope` and the run's output.
340
+ - **`--inspector-port`.** A test may pass its own: Supercov reads the Worker
341
+ through that port.
342
+ - **Knowing the run is measured.** `SUPERCOV_RUN_ID` is set in every process
343
+ a measured command starts, holding the run's id. The other `SUPERCOV_`
344
+ variables a test may see are Supercov's own wiring and change without
345
+ notice.
346
+ - **Output.** `cargo test -- --nocapture` shows each test's output as it is
347
+ written, as plain `cargo test` does.
348
+
311
349
  The Worker built with probes stays in the copy: its `build/` output is never
312
- returned to the project, and neither is the copy's configuration, which
313
- points `main` at Supercov's entry. wrangler's `.wrangler/` state is not a
314
- build input, so writing it does not make the run stale.
350
+ returned to the project, nor are wrangler's `.wrangler/` state and the
351
+ configuration copies above. Writing them does not make the run stale.
315
352
 
316
353
  ### Rust tests compiled to wasm
317
354
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supercov",
3
- "version": "4.20.0",
3
+ "version": "4.20.2",
4
4
  "description": "Coverage, security and code quality for coding agents",
5
5
  "keywords": [
6
6
  "coverage",
@@ -97,7 +97,8 @@
97
97
  "benchmark:python": "cargo build -p supercov && node scripts/python-benchmark.mjs",
98
98
  "check": "npm run check:lint && npm run check:tests",
99
99
  "check:lint": "cargo fmt --all -- --check && cargo clippy --workspace --all-targets -- -D warnings",
100
- "check:tests": "npm run test && npm run test:release-tooling && npm run test:runtime && npm run test:action && npm run test:rust-assets && npm run test:agent-commands && npm run test:assertions && npm run test:sweep-target && npm run test:skip-guard && npm run test:windows-tls && node scripts/package-preflight.mjs && node scripts/verify-binstall-metadata.mjs --offline",
100
+ "check:tests": "npm run test && npm run check:tooling",
101
+ "check:tooling": "npm run test:release-tooling && npm run test:runtime && npm run test:action && npm run test:rust-assets && npm run test:agent-commands && npm run test:assertions && npm run test:sweep-target && npm run test:skip-guard && npm run test:windows-tls && node scripts/package-preflight.mjs && node scripts/verify-binstall-metadata.mjs --offline",
101
102
  "release:check": "cargo clean && node scripts/sweep-target.mjs && npm run check && npm run test:engine && npm run test:go && npm run test:jvm && npm run test:launcher && npm run test:fixture && npm run test:watchdog && npm run test:engine-contract && npm run test:agent && npm run test:child-attribution && npm run test:host-loader && npm run test:python && npm run test:ruby-coverage && npm run test:rust-public-cargo && npm run test:packed-npx && npm run test:clang-mcdc && npm run benchmark:check",
102
103
  "release:bump": "node scripts/bump-version.mjs",
103
104
  "sweep": "node scripts/sweep-target.mjs",
@@ -121,14 +122,14 @@
121
122
  "test:windows-tls": "node scripts/windows-tls-test.mjs"
122
123
  },
123
124
  "optionalDependencies": {
124
- "@supercov/cli-darwin-arm64": "4.20.0",
125
- "@supercov/cli-darwin-x64": "4.20.0",
126
- "@supercov/cli-linux-arm64-gnu": "4.20.0",
127
- "@supercov/cli-linux-arm64-musl": "4.20.0",
128
- "@supercov/cli-linux-x64-gnu": "4.20.0",
129
- "@supercov/cli-linux-x64-musl": "4.20.0",
130
- "@supercov/cli-win32-arm64": "4.20.0",
131
- "@supercov/cli-win32-x64": "4.20.0"
125
+ "@supercov/cli-darwin-arm64": "4.20.2",
126
+ "@supercov/cli-darwin-x64": "4.20.2",
127
+ "@supercov/cli-linux-arm64-gnu": "4.20.2",
128
+ "@supercov/cli-linux-arm64-musl": "4.20.2",
129
+ "@supercov/cli-linux-x64-gnu": "4.20.2",
130
+ "@supercov/cli-linux-x64-musl": "4.20.2",
131
+ "@supercov/cli-win32-arm64": "4.20.2",
132
+ "@supercov/cli-win32-x64": "4.20.2"
132
133
  },
133
134
  "peerDependencies": {
134
135
  "@playwright/test": ">=1.55.0",