supercov 4.28.0 → 4.29.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.
- package/README.md +43 -16
- package/docs/cli.md +338 -2
- package/docs/getting-started.md +18 -0
- package/docs/mutation.md +588 -0
- package/docs/supported-suites.md +109 -60
- package/package.json +11 -10
- package/runtime/javascript/atomic.mjs +6 -2
- package/runtime/javascript/ava.mjs +12 -0
- package/runtime/javascript/bunTest.mjs +17 -0
- package/runtime/javascript/jest.cjs +67 -0
- package/runtime/javascript/jest.config.mjs +46 -6
- package/runtime/javascript/jestReporter.mjs +5 -2
- package/runtime/javascript/mocha.mjs +79 -5
- package/runtime/javascript/nodeTest.mjs +28 -0
- package/runtime/javascript/playwright.mjs +33 -0
- package/runtime/javascript/playwrightStrong.mjs +477 -0
- package/runtime/javascript/playwrightStrongReporter.mjs +377 -0
- package/runtime/javascript/resolve-loader.mjs +4 -1
- package/runtime/javascript/runnerEntry.mjs +62 -0
- package/runtime/javascript/runtime.mjs +752 -13
- package/runtime/javascript/snapshots.mjs +16 -1
- package/runtime/javascript/strongJestHost.mjs +103 -0
- package/runtime/javascript/strongJob.mjs +78 -0
- package/runtime/javascript/strongJobs.mjs +809 -0
- package/runtime/javascript/strongMochaHost.mjs +166 -0
- package/runtime/javascript/strongWasmOut.cjs +96 -0
- package/runtime/javascript/tap.mjs +43 -1
- package/runtime/javascript/transport.mjs +5 -0
- package/runtime/javascript/vitest.mjs +74 -2
- package/runtime/javascript/vitestBrowser.mjs +34 -2
- package/runtime/javascript/vitestStrong.mjs +234 -0
- package/runtime/javascript/vitestStrongReporter.mjs +2268 -0
- package/runtime/javascript/vitestStrongSpawner.mjs +248 -0
package/docs/supported-suites.md
CHANGED
|
@@ -16,22 +16,37 @@ npx supercov -- mvn test
|
|
|
16
16
|
|
|
17
17
|
## Language support
|
|
18
18
|
|
|
19
|
-
| Language | Status | Start with |
|
|
20
|
-
| --- | --- | --- |
|
|
21
|
-
| JavaScript | Available | `npx supercov -- npm test` |
|
|
22
|
-
| TypeScript | Available | `npx supercov -- npm test` |
|
|
23
|
-
| Rust | Available | `npx supercov -- cargo test` |
|
|
24
|
-
| Python | Available | `npx supercov -- pytest` |
|
|
25
|
-
| Ruby | Available | `npx supercov -- rspec` |
|
|
26
|
-
| Go | Available | `npx supercov -- go test ./...` |
|
|
27
|
-
| Java | Available | `npx supercov -- mvn test` |
|
|
28
|
-
| Kotlin | Available | `npx supercov -- ./gradlew test` |
|
|
29
|
-
| Zig | Coming soon | — |
|
|
30
|
-
| PHP | Coming soon | — |
|
|
31
|
-
| C | Coming soon | — |
|
|
19
|
+
| Language | Status | Start with | Mutation testing |
|
|
20
|
+
| --- | --- | --- | --- |
|
|
21
|
+
| JavaScript | Available | `npx supercov -- npm test` | StrykerJS 10.1.1's mutants |
|
|
22
|
+
| TypeScript | Available | `npx supercov -- npm test` | StrykerJS 10.1.1's mutants |
|
|
23
|
+
| Rust | Available | `npx supercov -- cargo test` | Preview: cargo-mutants 27.1.0's mutants |
|
|
24
|
+
| Python | Available | `npx supercov -- pytest` | Preview: mutmut 3.8.1's mutants |
|
|
25
|
+
| Ruby | Available | `npx supercov -- rspec` | Preview: mutant 0.17.1's mutants |
|
|
26
|
+
| Go | Available | `npx supercov -- go test ./...` | Preview: Gremlins 0.6.0's mutants |
|
|
27
|
+
| Java | Available | `npx supercov -- mvn test` | Not yet |
|
|
28
|
+
| Kotlin | Available | `npx supercov -- ./gradlew test` | Not yet |
|
|
29
|
+
| Zig | Coming soon | — | — |
|
|
30
|
+
| PHP | Coming soon | — | — |
|
|
31
|
+
| C | Coming soon | — | — |
|
|
32
32
|
|
|
33
33
|
The npm-distributed CLI requires Node.js 22 or newer for every language.
|
|
34
34
|
|
|
35
|
+
## Mutation testing
|
|
36
|
+
|
|
37
|
+
`npx supercov mutants -- <test command>` lists the mutants the language's
|
|
38
|
+
established tool would make of every source the run measured, says from the
|
|
39
|
+
run which ones no test reaches or infects, and runs the rest against the tests
|
|
40
|
+
that reach them. JavaScript and TypeScript are fully supported; Python, Rust,
|
|
41
|
+
Go and Ruby are in preview, each validated against its tool on public
|
|
42
|
+
projects; Java and Kotlin have no mutants yet. The Mutation testing column of
|
|
43
|
+
each runner table below says whether that runner's tests run against mutants.
|
|
44
|
+
A runner without a strong driver still gets the mutants list and the weak
|
|
45
|
+
report, from its coverage; its mutants are `error` in a strong pass, counted
|
|
46
|
+
per runner. See
|
|
47
|
+
[Mutation testing](mutation.md) for each language's limits and how its
|
|
48
|
+
verdicts compare with its tool's.
|
|
49
|
+
|
|
35
50
|
## What exact and aggregate mean
|
|
36
51
|
|
|
37
52
|
**Exact attribution** means Supercov knows which test, attempt, retry, and
|
|
@@ -46,18 +61,18 @@ Supercov reports the level it actually observed. It does not guess.
|
|
|
46
61
|
|
|
47
62
|
## JavaScript and TypeScript
|
|
48
63
|
|
|
49
|
-
| Runner | Attribution |
|
|
50
|
-
| --- | --- |
|
|
51
|
-
| Playwright | Exact per test, worker, retry, outcome, action, and assertion phase |
|
|
52
|
-
| Vitest | Exact per test, with setup execution kept separate; Browser Mode included |
|
|
53
|
-
| Jest | Exact per test, including parameterized tests, with the user's own configuration, setup files and reporters kept |
|
|
54
|
-
| `node:test` | Exact per test |
|
|
55
|
-
| `bun:test` (Bun 1.2.17 and 1.4.4 verified) | Exact test-body coverage, including concurrent and parameterized tests; lifecycle hooks recorded as setup |
|
|
56
|
-
| Mocha | Exact per test and retry, `--parallel` included, with setup execution kept separate |
|
|
57
|
-
| AVA | Exact per test, concurrent tests included, in worker threads or child processes |
|
|
58
|
-
| node-tap 15 and newer | Exact per subtest, nested and parallel (`t.jobs`) subtests included |
|
|
59
|
-
| Other Node-based runners | Aggregate when their processes remain visible to Supercov |
|
|
60
|
-
| Browser component runners without an adapter | Aggregate structural coverage |
|
|
64
|
+
| Runner | Attribution | Mutation testing |
|
|
65
|
+
| --- | --- | --- |
|
|
66
|
+
| Playwright | Exact per test, worker, retry, outcome, action, and assertion phase | Yes: each test's mutant travels with its requests |
|
|
67
|
+
| Vitest | Exact per test, with setup execution kept separate; Browser Mode included | Yes, Browser Mode included |
|
|
68
|
+
| Jest | Exact per test, including parameterized tests, with the user's own configuration, setup files and reporters kept; the configuration is read from Jest 27 on (before 29.3 through `jest-config`'s own build) | Yes |
|
|
69
|
+
| `node:test` | Exact per test | Yes |
|
|
70
|
+
| `bun:test` (Bun 1.2.17 and 1.4.4 verified) | Exact test-body coverage, including concurrent and parameterized tests; lifecycle hooks recorded as setup | Yes |
|
|
71
|
+
| Mocha | Exact per test and retry, `--parallel` included, with setup execution kept separate | Yes |
|
|
72
|
+
| AVA | Exact per test, concurrent tests included, in worker threads or child processes | Yes |
|
|
73
|
+
| node-tap 15 and newer | Exact per subtest, nested and parallel (`t.jobs`) subtests included | Yes |
|
|
74
|
+
| Other Node-based runners | Aggregate when their processes remain visible to Supercov | Weak report only |
|
|
75
|
+
| Browser component runners without an adapter | Aggregate structural coverage | Weak report only |
|
|
61
76
|
|
|
62
77
|
One command may launch several runners. Supercov combines their evidence into
|
|
63
78
|
one run and preserves runner identity wherever the runner exposes it.
|
|
@@ -183,11 +198,11 @@ loses nothing there either.
|
|
|
183
198
|
|
|
184
199
|
## Rust
|
|
185
200
|
|
|
186
|
-
| Runner | Attribution | Current requirement |
|
|
187
|
-
| --- | --- | --- |
|
|
188
|
-
| Cargo's standard libtest runner | Exact test, attempt, and passing-assertion identity | Rust 1.95; run with `npx supercov -- cargo test` |
|
|
189
|
-
| rustdoc doctests | Exact doctest identity; every doctest runs in a process of its own | Rust 1.95; part of `npx supercov -- cargo test` |
|
|
190
|
-
| cargo-nextest | Exact test, attempt, retry, and binary identity | cargo-nextest 0.9.138 or newer (tested with 0.9.140 and 0.9.148) |
|
|
201
|
+
| Runner | Attribution | Current requirement | Mutation testing |
|
|
202
|
+
| --- | --- | --- | --- |
|
|
203
|
+
| Cargo's standard libtest runner | Exact test, attempt, and passing-assertion identity | Rust 1.95; run with `npx supercov -- cargo test` | Preview |
|
|
204
|
+
| rustdoc doctests | Exact doctest identity; every doctest runs in a process of its own | Rust 1.95; part of `npx supercov -- cargo test` | Preview |
|
|
205
|
+
| cargo-nextest | Exact test, attempt, retry, and binary identity | cargo-nextest 0.9.138 or newer (tested with 0.9.140 and 0.9.148) | Preview, with the project's nextest configuration |
|
|
191
206
|
|
|
192
207
|
Supercov preserves Cargo's test selection, scheduling, fail-fast behavior,
|
|
193
208
|
environment and exit status. Doctests run with their own identities; nextest
|
|
@@ -226,6 +241,18 @@ npx supercov -- cargo nextest run --workspace
|
|
|
226
241
|
explanation instead of silently falling back to plausible but inaccurate
|
|
227
242
|
attribution.
|
|
228
243
|
|
|
244
|
+
### Mutation testing (preview)
|
|
245
|
+
|
|
246
|
+
`supercov runs latest mutants` lists cargo-mutants' mutants (27.1.0) of the
|
|
247
|
+
files a Rust run measured, with what the run's tests tell of each, and
|
|
248
|
+
`supercov runs latest mutants test` runs them against the tests that reach
|
|
249
|
+
them, for `cargo test` (libtest and doctests) and `cargo nextest run`: every
|
|
250
|
+
mutant of a pass in one build, each test by its exact name in its own
|
|
251
|
+
process. A mutant that does not compile is `unviable`, as cargo-mutants
|
|
252
|
+
reports it. Tests built for wasm run against mutants in Node, under WASI
|
|
253
|
+
and in Chrome; tests run in Firefox, Safari or Edge, which are not measured,
|
|
254
|
+
have their mutants recorded as `error`. See `docs/design/rust-mutation.md`.
|
|
255
|
+
|
|
229
256
|
### Rust compiled to wasm in JavaScript tests
|
|
230
257
|
|
|
231
258
|
A crate wasm-bindgen exposes to JavaScript (a `cdylib` that depends on
|
|
@@ -248,6 +275,12 @@ is credited exactly with its own lines and decisions. The crate's coverage is
|
|
|
248
275
|
a Rust run beside the JavaScript run. What the copy built (`target/`, and the
|
|
249
276
|
generated `pkg/` with its instrumented wasm) stays in the copy.
|
|
250
277
|
|
|
278
|
+
`supercov runs <rust run> mutants test` runs the crate's mutants under the
|
|
279
|
+
tests that load it, in Node (node:test, Vitest, Jest and the other job
|
|
280
|
+
runners) and in Playwright's pages: the command builds the wasm from the
|
|
281
|
+
crate with the mutants switched in, and each wasm instance is handed the
|
|
282
|
+
mutant to run.
|
|
283
|
+
|
|
251
284
|
### A Rust Worker under browser tests
|
|
252
285
|
|
|
253
286
|
A Playwright suite that starts a Cloudflare Worker written in Rust with
|
|
@@ -424,12 +457,12 @@ npx supercov -- wasm-pack test --headless --chrome
|
|
|
424
457
|
|
|
425
458
|
## Python
|
|
426
459
|
|
|
427
|
-
| Runner | Attribution | Current requirement |
|
|
428
|
-
| --- | --- | --- |
|
|
429
|
-
| pytest | Exact test, worker, retry, and setup/call/teardown phase identity | CPython 3.9 or newer; run with `npx supercov -- pytest` or `python -m pytest` |
|
|
430
|
-
| pytest-xdist | Exact per worker | Workers inherit the run through the environment |
|
|
431
|
-
| pytest-rerunfailures | Exact per attempt; flaky tests are reported as such | |
|
|
432
|
-
| `python -m unittest` | Exact test and setUp/test/tearDown phase identity | Serial in-process; skips and expected failures are recorded; subtest failures roll up to the parent test |
|
|
460
|
+
| Runner | Attribution | Current requirement | Mutation testing |
|
|
461
|
+
| --- | --- | --- | --- |
|
|
462
|
+
| pytest | Exact test, worker, retry, and setup/call/teardown phase identity | CPython 3.9 or newer; run with `npx supercov -- pytest` or `python -m pytest` | Preview, on Linux and macOS |
|
|
463
|
+
| pytest-xdist | Exact per worker | Workers inherit the run through the environment | Preview: the pass turns xdist off and forks its own workers |
|
|
464
|
+
| pytest-rerunfailures | Exact per attempt; flaky tests are reported as such | | Preview, not verified |
|
|
465
|
+
| `python -m unittest` | Exact test and setUp/test/tearDown phase identity | Serial in-process; skips and expected failures are recorded; subtest failures roll up to the parent test | Preview, on Linux and macOS; not a suite that runs unittest through its own script |
|
|
433
466
|
|
|
434
467
|
Your project runs in place with its own interpreter and virtual environment.
|
|
435
468
|
Supercov adds its runner hooks through the process environment and places a
|
|
@@ -501,14 +534,14 @@ when you set it, list the Python directories as well.
|
|
|
501
534
|
|
|
502
535
|
## Ruby
|
|
503
536
|
|
|
504
|
-
| Runner | Attribution | Current requirement |
|
|
505
|
-
| --- | --- | --- |
|
|
506
|
-
| RSpec | Exact example and before/example/after phase identity | Ruby 3.4 or newer for full measurement; run with `npx supercov -- rspec` or `bundle exec rspec` |
|
|
507
|
-
| Minitest (including Minitest::Spec and ActiveSupport::TestCase) | Exact test and setup/test/teardown identity; skips recorded | `ruby -Itest ...`, `rake test`, `rails test` |
|
|
508
|
-
| test-unit | Exact test and setup/test/teardown identity; omissions and pendings recorded | `ruby -Itest ...`, `rake test` |
|
|
509
|
-
| parallel_tests, Rails process workers | Exact per worker process | Workers inherit the run through `RUBYOPT`; verified on a Rails app with bootsnap, Zeitwerk and two forked workers |
|
|
510
|
-
| Thread-parallel Minitest (`parallelize_me!`, `parallelize(with: :threads)`) | Probe observations exact per test; line, method and simple-branch observations made while phases overlapped go to the run, declared | |
|
|
511
|
-
| Cucumber | Exact scenario identity (`features/x.feature:LINE`), hook steps as setup/teardown | `cucumber`, `bundle exec cucumber` |
|
|
537
|
+
| Runner | Attribution | Current requirement | Mutation testing |
|
|
538
|
+
| --- | --- | --- | --- |
|
|
539
|
+
| RSpec | Exact example and before/example/after phase identity | Ruby 3.4 or newer for full measurement; run with `npx supercov -- rspec` or `bundle exec rspec` | Preview |
|
|
540
|
+
| Minitest (including Minitest::Spec and ActiveSupport::TestCase) | Exact test and setup/test/teardown identity; skips recorded | `ruby -Itest ...`, `rake test`, `rails test` | Preview |
|
|
541
|
+
| test-unit | Exact test and setup/test/teardown identity; omissions and pendings recorded | `ruby -Itest ...`, `rake test` | Preview (test-unit 3.7 verified) |
|
|
542
|
+
| parallel_tests, Rails process workers | Exact per worker process | Workers inherit the run through `RUBYOPT`; verified on a Rails app with bootsnap, Zeitwerk and two forked workers | Preview, not verified |
|
|
543
|
+
| Thread-parallel Minitest (`parallelize_me!`, `parallelize(with: :threads)`) | Probe observations exact per test; line, method and simple-branch observations made while phases overlapped go to the run, declared | | Preview, not verified |
|
|
544
|
+
| Cucumber | Exact scenario identity (`features/x.feature:LINE`), hook steps as setup/teardown | `cucumber`, `bundle exec cucumber` | Preview (Cucumber 12 verified) |
|
|
512
545
|
|
|
513
546
|
Every test is credited with every line it runs: each statement of an
|
|
514
547
|
instrumented file carries a probe. Code Supercov cannot instrument -- a file
|
|
@@ -526,6 +559,14 @@ stay unchanged. RSpec, Minitest and test-unit assertions can identify execution
|
|
|
526
559
|
before a passing assertion. That timing evidence alone does not show which
|
|
527
560
|
values the assertion checks.
|
|
528
561
|
|
|
562
|
+
Mutation testing of Ruby is in preview: `supercov mutants` lists a Ruby run's
|
|
563
|
+
mutants as the mutant gem (0.17.1, its light operators) makes them for every
|
|
564
|
+
method, and runs them under RSpec, Minitest, test-unit and Cucumber, one fork
|
|
565
|
+
of the loaded suite per mutant (`supercov runs latest mutants test` runs them
|
|
566
|
+
over a run already measured). `--stryker` also reads mutant's session results
|
|
567
|
+
(`.mutant/results`) and joins them by the method each mutation makes. See
|
|
568
|
+
[Mutation testing](mutation.md).
|
|
569
|
+
|
|
529
570
|
Ruby 3.3 and newer support statement, method, branch and MC/DC measurement,
|
|
530
571
|
including loops, iterator blocks, short-circuit operators, pattern matching,
|
|
531
572
|
optional calls and exception paths.
|
|
@@ -607,11 +648,11 @@ what changes is whether a line can be traced to the test that ran it.
|
|
|
607
648
|
|
|
608
649
|
## Go
|
|
609
650
|
|
|
610
|
-
| Runner | Attribution | Current requirement |
|
|
611
|
-
| --- | --- | --- |
|
|
612
|
-
| `go test` | Exact per test | Go 1.22 or newer |
|
|
613
|
-
| A test that calls `t.Parallel()` | Aggregate: its coverage counts run-wide | — |
|
|
614
|
-
| An `Example` with an `Output` comment, and a `Fuzz` target's seed corpus | Aggregate: measured, but named by no test | — |
|
|
651
|
+
| Runner | Attribution | Current requirement | Mutation testing |
|
|
652
|
+
| --- | --- | --- | --- |
|
|
653
|
+
| `go test` | Exact per test | Go 1.22 or newer | Preview: each package run whole, with the command's own flags |
|
|
654
|
+
| A test that calls `t.Parallel()` | Aggregate: its coverage counts run-wide | — | Preview, with the rest of its package |
|
|
655
|
+
| An `Example` with an `Output` comment, and a `Fuzz` target's seed corpus | Aggregate: measured, but named by no test | — | Preview, with the rest of their package |
|
|
615
656
|
|
|
616
657
|
Supercov instruments an isolated copy of the module and runs your own command
|
|
617
658
|
against it. Your tree is not touched, and your test sources are not rewritten
|
|
@@ -664,6 +705,14 @@ npx supercov -- go test -run TestParser ./internal/...
|
|
|
664
705
|
npx supercov -- go test ./core/... ./app/...
|
|
665
706
|
```
|
|
666
707
|
|
|
708
|
+
### Mutation testing in Go (preview)
|
|
709
|
+
|
|
710
|
+
`npx supercov mutants -- go test ./...` lists Gremlins 0.6.0's mutants of
|
|
711
|
+
every Go source the run measures and runs each against the tests that ran
|
|
712
|
+
its code, in test binaries built once (`go test -c`), one process per
|
|
713
|
+
mutant and package, tests picked by exact name. A mutant that does not
|
|
714
|
+
compile is reported `unviable` rather than run.
|
|
715
|
+
|
|
667
716
|
### A Go server under browser tests
|
|
668
717
|
|
|
669
718
|
A Playwright suite that starts a Go server with `go run` measures it: the copy
|
|
@@ -770,17 +819,17 @@ npx supercov -- npx playwright test
|
|
|
770
819
|
|
|
771
820
|
## Java and Kotlin
|
|
772
821
|
|
|
773
|
-
| Runner | Attribution | Current requirement |
|
|
774
|
-
| --- | --- | --- |
|
|
775
|
-
| JUnit 5 (Jupiter) | Exact per test | JDK 17 or newer, Maven or Gradle |
|
|
776
|
-
| JUnit 4 (through Vintage) | Exact per test | — |
|
|
777
|
-
| Kotest | Exact per test, under the names Kotest itself reports | — |
|
|
778
|
-
| Spock | Exact per feature, under the names Spock itself reports | — |
|
|
779
|
-
| TestNG | Exact per test, each data-provider invocation its own | — |
|
|
780
|
-
| JUnit 4 alone | Exact per test, through Vintage — see below | Maven or Gradle |
|
|
781
|
-
| JUnit 4 under Ant's `<junit>` | Exact per test, under the names Ant's XML report uses | Ant 1.10 — see below |
|
|
782
|
-
| Any platform engine under Ant's `<junitlauncher>` | Exact per test, through the platform listener | Ant 1.10 — see below |
|
|
783
|
-
| TestNG under Ant's `<testng>` | Exact per test, through the TestNG listener | TestNG 6.x with its Ant task — see below |
|
|
822
|
+
| Runner | Attribution | Current requirement | Mutation testing |
|
|
823
|
+
| --- | --- | --- | --- |
|
|
824
|
+
| JUnit 5 (Jupiter) | Exact per test | JDK 17 or newer, Maven or Gradle | Not yet |
|
|
825
|
+
| JUnit 4 (through Vintage) | Exact per test | — | Not yet |
|
|
826
|
+
| Kotest | Exact per test, under the names Kotest itself reports | — | Not yet |
|
|
827
|
+
| Spock | Exact per feature, under the names Spock itself reports | — | Not yet |
|
|
828
|
+
| TestNG | Exact per test, each data-provider invocation its own | — | Not yet |
|
|
829
|
+
| JUnit 4 alone | Exact per test, through Vintage — see below | Maven or Gradle | Not yet |
|
|
830
|
+
| JUnit 4 under Ant's `<junit>` | Exact per test, under the names Ant's XML report uses | Ant 1.10 — see below | Not yet |
|
|
831
|
+
| Any platform engine under Ant's `<junitlauncher>` | Exact per test, through the platform listener | Ant 1.10 — see below | Not yet |
|
|
832
|
+
| TestNG under Ant's `<testng>` | Exact per test, through the TestNG listener | TestNG 6.x with its Ant task — see below | Not yet |
|
|
784
833
|
|
|
785
834
|
Multi-module builds are measured module by module: each compiles its own source
|
|
786
835
|
set and forks its own JVM, so each gets a runtime and records evidence of its
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "supercov",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.29.1",
|
|
4
4
|
"description": "Coverage, security and code quality for coding agents",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"coverage",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"docs/getting-started.md",
|
|
36
36
|
"docs/agent-loop.md",
|
|
37
37
|
"docs/assertions.md",
|
|
38
|
+
"docs/mutation.md",
|
|
38
39
|
"docs/quality.md",
|
|
39
40
|
"docs/security.md",
|
|
40
41
|
"docs/troubleshooting.md",
|
|
@@ -82,7 +83,7 @@
|
|
|
82
83
|
"eval:skill": "claude plugin eval plugins/supercov --scaffold --trust-plugin --no-publish --model claude-sonnet-5 --judge-model claude-haiku-4-5 --threshold 0.66 --tag behavior trigger --allow-tools Bash Edit Write --max-cost-usd 15",
|
|
83
84
|
"eval:skill-triggers": "claude plugin eval plugins/supercov --scaffold --trust-plugin --no-publish --model claude-sonnet-5 --judge-model claude-haiku-4-5 --threshold 0.66 --tag trigger --ablation none --max-cost-usd 5",
|
|
84
85
|
"test:engine": "cargo fmt --all -- --check && cargo clippy --workspace --all-targets -- -D warnings && cargo test --workspace && npm run test:runtime && npm run test:rust-assets && npm run test:engine-integrations",
|
|
85
|
-
"test:engine-integrations": "cargo build -p supercov && node scripts/html-report-integration.mjs && node scripts/rust-process-supervision.mjs && node scripts/rust-direct-node-integration.mjs && node scripts/rust-public-run-integration.mjs && node scripts/rust-embedded-runtime-integration.mjs && node scripts/rust-direct-vitest-integration.mjs && node scripts/rust-nested-vitest-integration.mjs && node scripts/rust-direct-jest-integration.mjs && node scripts/mocha-failure-output.mjs && node scripts/failure-output.mjs node ava tap && node scripts/side-by-side.mjs node && node scripts/merge-across.mjs && node scripts/import-line-evidence.mjs && node scripts/mock-reach.mjs && node scripts/rust-direct-playwright-integration.mjs && node scripts/rust-custom-browser-playwright-integration.mjs && node scripts/cross-origin-requests.mjs && node scripts/leaving-page.mjs && node scripts/shared-page.mjs && node scripts/context-script-copies.mjs && node scripts/context-headers.mjs && node scripts/context-cookies.mjs && node scripts/hidden-request-emit.mjs && node scripts/js-syntax-zoo.mjs && node scripts/ruby-syntax-zoo.mjs && node scripts/rust-syntax-zoo.mjs && node scripts/python-syntax-zoo.mjs && node scripts/go-syntax-zoo.mjs && node scripts/java-syntax-zoo.mjs && node scripts/background-by-time.mjs && node scripts/python-server-playwright.mjs && node scripts/ruby-server-playwright.mjs && node scripts/go-server-playwright.mjs && node scripts/jvm-server-playwright.mjs && node scripts/docker-server-playwright.mjs && node scripts/docker-clients-playwright.mjs && node scripts/docker-exec-playwright.mjs && node scripts/rust-classic-browser-integration.mjs && node scripts/exec-handover.mjs && node scripts/rust-region-container.mjs && node scripts/rust-top-packages-integration.mjs && node scripts/rust-generic-esbuild-integration.mjs && node scripts/rust-generic-tsc-integration.mjs && node scripts/rust-generic-build-matrix.mjs && node scripts/rust-vite-playwright-integration.mjs && node scripts/workspace-crash-integration.mjs",
|
|
86
|
+
"test:engine-integrations": "cargo build -p supercov && node scripts/html-report-integration.mjs && node scripts/mutation-report-formats.mjs && node scripts/rust-process-supervision.mjs && node scripts/rust-direct-node-integration.mjs && node scripts/rust-public-run-integration.mjs && node scripts/rust-embedded-runtime-integration.mjs && node scripts/rust-direct-vitest-integration.mjs && node scripts/rust-nested-vitest-integration.mjs && node scripts/rust-direct-jest-integration.mjs && node scripts/mocha-failure-output.mjs && node scripts/failure-output.mjs node ava tap && node scripts/side-by-side.mjs node && node scripts/merge-across.mjs && node scripts/import-line-evidence.mjs && node scripts/mock-reach.mjs && node scripts/rust-direct-playwright-integration.mjs && node scripts/rust-custom-browser-playwright-integration.mjs && node scripts/cross-origin-requests.mjs && node scripts/leaving-page.mjs && node scripts/shared-page.mjs && node scripts/context-script-copies.mjs && node scripts/context-headers.mjs && node scripts/context-cookies.mjs && node scripts/hidden-request-emit.mjs && node scripts/js-syntax-zoo.mjs && node scripts/ruby-syntax-zoo.mjs && node scripts/rust-syntax-zoo.mjs && node scripts/python-syntax-zoo.mjs && node scripts/go-syntax-zoo.mjs && node scripts/java-syntax-zoo.mjs && node scripts/background-by-time.mjs && node scripts/python-server-playwright.mjs && node scripts/ruby-server-playwright.mjs && node scripts/go-server-playwright.mjs && node scripts/jvm-server-playwright.mjs && node scripts/docker-server-playwright.mjs && node scripts/docker-clients-playwright.mjs && node scripts/docker-exec-playwright.mjs && node scripts/rust-classic-browser-integration.mjs && node scripts/exec-handover.mjs && node scripts/rust-region-container.mjs && node scripts/rust-top-packages-integration.mjs && node scripts/rust-generic-esbuild-integration.mjs && node scripts/rust-generic-tsc-integration.mjs && node scripts/rust-generic-build-matrix.mjs && node scripts/rust-vite-playwright-integration.mjs && node scripts/workspace-crash-integration.mjs",
|
|
86
87
|
"test:platform": "cargo test --workspace && cargo build -p supercov && node scripts/rust-process-supervision.mjs && node scripts/workspace-crash-integration.mjs",
|
|
87
88
|
"test:native-package": "cargo build --release -p supercov && node scripts/native-package-integration.mjs && node scripts/native-release-set-integration.mjs",
|
|
88
89
|
"test:pypi-wheel": "node scripts/pypi-wheel-integration.mjs",
|
|
@@ -124,14 +125,14 @@
|
|
|
124
125
|
"test:windows-tls": "node scripts/windows-tls-test.mjs"
|
|
125
126
|
},
|
|
126
127
|
"optionalDependencies": {
|
|
127
|
-
"@supercov/cli-darwin-arm64": "4.
|
|
128
|
-
"@supercov/cli-darwin-x64": "4.
|
|
129
|
-
"@supercov/cli-linux-arm64-gnu": "4.
|
|
130
|
-
"@supercov/cli-linux-arm64-musl": "4.
|
|
131
|
-
"@supercov/cli-linux-x64-gnu": "4.
|
|
132
|
-
"@supercov/cli-linux-x64-musl": "4.
|
|
133
|
-
"@supercov/cli-win32-arm64": "4.
|
|
134
|
-
"@supercov/cli-win32-x64": "4.
|
|
128
|
+
"@supercov/cli-darwin-arm64": "4.29.1",
|
|
129
|
+
"@supercov/cli-darwin-x64": "4.29.1",
|
|
130
|
+
"@supercov/cli-linux-arm64-gnu": "4.29.1",
|
|
131
|
+
"@supercov/cli-linux-arm64-musl": "4.29.1",
|
|
132
|
+
"@supercov/cli-linux-x64-gnu": "4.29.1",
|
|
133
|
+
"@supercov/cli-linux-x64-musl": "4.29.1",
|
|
134
|
+
"@supercov/cli-win32-arm64": "4.29.1",
|
|
135
|
+
"@supercov/cli-win32-x64": "4.29.1"
|
|
135
136
|
},
|
|
136
137
|
"peerDependencies": {
|
|
137
138
|
"@playwright/test": ">=1.55.0",
|
|
@@ -125,7 +125,11 @@ export function atomicRenameSync(source, destination) {
|
|
|
125
125
|
const journals = new Map();
|
|
126
126
|
export function appendEvidenceRecord(directory, prefix, payload) {
|
|
127
127
|
const line = `${JSON.stringify(payload)}\n`;
|
|
128
|
-
|
|
128
|
+
// One journal per directory and writer: a process may write into more
|
|
129
|
+
// than one evidence directory over its life (a strong pass's resident
|
|
130
|
+
// Jest, one per job).
|
|
131
|
+
const journalKey = `${directory}\0${prefix}`;
|
|
132
|
+
let journal = journals.get(journalKey);
|
|
129
133
|
if (journal) {
|
|
130
134
|
let size = -1;
|
|
131
135
|
try {
|
|
@@ -141,7 +145,7 @@ export function appendEvidenceRecord(directory, prefix, payload) {
|
|
|
141
145
|
const writer = (process.env.SUPERCOV_EXECUTION_LOG_SHARD ?? `pid-${process.pid}`)
|
|
142
146
|
.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
143
147
|
journal = { path: resolve(directory, `${prefix}-${writer}-${randomUUID()}.mcdc.jsonl`), size: 0 };
|
|
144
|
-
journals.set(
|
|
148
|
+
journals.set(journalKey, journal);
|
|
145
149
|
}
|
|
146
150
|
const append = process.env.SUPERCOV_DURABLE_EVIDENCE_EACH_TEST === "1"
|
|
147
151
|
? appendJsonLineDurableSync
|
|
@@ -12,6 +12,7 @@ import { join } from "node:path";
|
|
|
12
12
|
import { pathToFileURL } from "node:url";
|
|
13
13
|
import { beginBufferedServerEvidence, flushBufferedServerEvidence, takeNodeAssertionPhases, withCoverageCarrier, } from "./runtime.mjs";
|
|
14
14
|
import { runnerExecutionScope, stackAsWritten, writeRunnerEvidence } from "./runnerEvidence.mjs";
|
|
15
|
+
import { strongJob } from "./strongJob.mjs";
|
|
15
16
|
|
|
16
17
|
// The installed ava package the entrypoint belongs to.
|
|
17
18
|
function avaRoot(entrypoint) {
|
|
@@ -60,11 +61,19 @@ export async function adaptAva(entrypoint) {
|
|
|
60
61
|
const runTest = Runner?.prototype?.runTest;
|
|
61
62
|
if (typeof runTest !== "function" || runTest.supercovAva)
|
|
62
63
|
return;
|
|
64
|
+
const job = strongJob();
|
|
63
65
|
Runner.prototype.runTest = function supercovAvaRunTest(task, contextRef) {
|
|
64
66
|
// AVA refuses two tests with one title in a file, so the title names
|
|
65
67
|
// the test.
|
|
66
68
|
const identity = { runner: "ava", file: this.file, name: task.title };
|
|
67
69
|
const scope = runnerExecutionScope(identity);
|
|
70
|
+
// A strong pass's job runs its own tests, none after its first
|
|
71
|
+
// failure; a test it leaves out runs no hook and counts as passed.
|
|
72
|
+
if (job && (job.stopped || !job.selects(this.file, scope.testId))) {
|
|
73
|
+
if (job.stopped)
|
|
74
|
+
writeRunnerEvidence(identity, "skipped", scope, evidenceDirectory);
|
|
75
|
+
return Promise.resolve(true);
|
|
76
|
+
}
|
|
68
77
|
beginBufferedServerEvidence(scope);
|
|
69
78
|
const finish = (status) => writeRunnerEvidence(identity, status, scope, evidenceDirectory, takeNodeAssertionPhases(scope), flushBufferedServerEvidence(scope));
|
|
70
79
|
let settled;
|
|
@@ -76,9 +85,12 @@ export async function adaptAva(entrypoint) {
|
|
|
76
85
|
throw error;
|
|
77
86
|
}
|
|
78
87
|
return settled.then((passed) => {
|
|
88
|
+
if (!passed)
|
|
89
|
+
job?.fail();
|
|
79
90
|
finish(passed ? "passed" : "failed");
|
|
80
91
|
return passed;
|
|
81
92
|
}, (error) => {
|
|
93
|
+
job?.fail();
|
|
82
94
|
finish("failed");
|
|
83
95
|
throw error;
|
|
84
96
|
});
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import * as runtime from "./runtime.mjs";
|
|
7
7
|
import { callerLocation, runnerExecutionScope, runnerTestId, writeRunnerEvidence } from "./runnerEvidence.mjs";
|
|
8
8
|
import { adaptRunnerEntry } from "./runnerEntry.mjs";
|
|
9
|
+
import { strongJob } from "./strongJob.mjs";
|
|
9
10
|
|
|
10
11
|
// Bun runs no Node preload: a runner it starts is adapted here.
|
|
11
12
|
await adaptRunnerEntry(process.argv[1]?.replaceAll("\\", "/") ?? "");
|
|
@@ -72,6 +73,14 @@ function adapt(api) {
|
|
|
72
73
|
for (const active of [...suites.map(suite => suite.flags), flags]) {
|
|
73
74
|
for (const [key, value] of Object.entries(active)) effective[key] ||= value;
|
|
74
75
|
}
|
|
76
|
+
// A strong pass's job runs its own tests.
|
|
77
|
+
const job = kind === "test" ? strongJob() : null;
|
|
78
|
+
if (job && callback && !job.selects(identity.file, runnerExecutionScope(identity).testId)) {
|
|
79
|
+
const skip = Reflect.get(original, "skip", original);
|
|
80
|
+
const next = [...args];
|
|
81
|
+
next[index] = () => { };
|
|
82
|
+
return Reflect.apply(typeof skip === "function" ? skip : original, original, next);
|
|
83
|
+
}
|
|
75
84
|
if (!callback) {
|
|
76
85
|
const result = Reflect.apply(original, this, args);
|
|
77
86
|
writeEvidence(identity, effective.todo ? "todo" : "skipped", runnerExecutionScope(identity), evidenceDirectory);
|
|
@@ -90,9 +99,17 @@ function adapt(api) {
|
|
|
90
99
|
attempts.set(scope.attemptId, { identity: current, phases: [] });
|
|
91
100
|
writeEvidence(current, "unknown", scope, evidenceDirectory);
|
|
92
101
|
let finished = false;
|
|
102
|
+
// None after the job's first failure.
|
|
103
|
+
if (job?.stopped) {
|
|
104
|
+
writeEvidence(current, "skipped", scope, evidenceDirectory);
|
|
105
|
+
const done = values[row.bound ?? 0];
|
|
106
|
+
if (callback.length > (row.bound ?? 0) && typeof done === "function") done();
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
93
109
|
function finish(failed = false) {
|
|
94
110
|
if (finished) return;
|
|
95
111
|
finished = true;
|
|
112
|
+
if (failed !== Boolean(effective.failing)) job?.fail();
|
|
96
113
|
attempts.delete(scope.attemptId);
|
|
97
114
|
const status = effective.todo ? "todo" : failed === Boolean(effective.failing) ? "passed" : "failed";
|
|
98
115
|
writeEvidence(current, status, scope, evidenceDirectory, runtime.takeNodeAssertionPhases(scope));
|
|
@@ -144,6 +144,73 @@ function writeEvidence(payload) {
|
|
|
144
144
|
journal.size += Buffer.byteLength(line);
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
+
// A strong pass's job (strongJob.mjs, which this CommonJS file cannot
|
|
148
|
+
// import): the tests of this file it runs, and whether it stops at the
|
|
149
|
+
// first failure.
|
|
150
|
+
function readStrongJob() {
|
|
151
|
+
const path = process.env.SUPERCOV_STRONG_JOB;
|
|
152
|
+
if (!path)
|
|
153
|
+
return null;
|
|
154
|
+
try {
|
|
155
|
+
const spec = JSON.parse(require("node:fs").readFileSync(path, "utf8"));
|
|
156
|
+
const files = new Map(Object.entries(spec.files ?? {}));
|
|
157
|
+
const known = new Set(spec.known ?? []);
|
|
158
|
+
return {
|
|
159
|
+
bail: spec.bail === true,
|
|
160
|
+
selects(file, testId) {
|
|
161
|
+
if (!files.has(file))
|
|
162
|
+
return !known.has(file);
|
|
163
|
+
const tests = files.get(file);
|
|
164
|
+
return tests === null || tests.includes(testId);
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
catch {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
// Circus's state, where it keeps the file's tests.
|
|
173
|
+
function circusState() {
|
|
174
|
+
const symbol = Object.getOwnPropertySymbols(globalThis)
|
|
175
|
+
.find(key => key.description === "JEST_STATE_SYMBOL");
|
|
176
|
+
return symbol && globalThis[symbol];
|
|
177
|
+
}
|
|
178
|
+
// Each test of the file with its id, as the reporter names it.
|
|
179
|
+
function eachTest(state, testFile, visitTest) {
|
|
180
|
+
const names = new Map();
|
|
181
|
+
function visit(block, parents) {
|
|
182
|
+
for (const child of block.children ?? []) {
|
|
183
|
+
if (child.type === "describeBlock") visit(child, [...parents, child.name]);
|
|
184
|
+
else if (child.type === "test") {
|
|
185
|
+
const name = [...parents, child.name].join(" ");
|
|
186
|
+
const occurrence = names.get(name) ?? 0;
|
|
187
|
+
names.set(name, occurrence + 1);
|
|
188
|
+
visitTest(child, testIdentity(testFile, name, occurrence));
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (state?.rootDescribeBlock) visit(state.rootDescribeBlock, []);
|
|
193
|
+
}
|
|
194
|
+
const strongJob = readStrongJob();
|
|
195
|
+
if (strongJob && typeof beforeAll === "function" && typeof afterEach === "function") {
|
|
196
|
+
// Before the file's first test, every test the job does not run is
|
|
197
|
+
// skipped; Circus then runs no hook of a describe block left without one.
|
|
198
|
+
beforeAll(() => {
|
|
199
|
+
const testFile = localFile(expect.getState().testPath ?? "unknown");
|
|
200
|
+
eachTest(circusState(), testFile, (test, testId) => {
|
|
201
|
+
if (!strongJob.selects(testFile, testId)) test.mode = "skip";
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
// The first failure settles the job's mutant: the rest are skipped.
|
|
205
|
+
afterEach(() => {
|
|
206
|
+
const state = circusState();
|
|
207
|
+
if (!strongJob.bail || !(state?.currentlyRunningTest?.errors?.length > 0)) return;
|
|
208
|
+
eachTest(state, "", (test) => {
|
|
209
|
+
if (test !== state.currentlyRunningTest) test.mode = "skip";
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
|
|
147
214
|
if (runtime && evidenceDirectory && typeof beforeEach === "function" && typeof afterAll === "function") {
|
|
148
215
|
// One in-memory snapshot per test; the server JSONL transport would be
|
|
149
216
|
// redundant and unattributed, as under Vitest.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// Jest accepts, or the "jest" key of package.json -- and adds the adapter
|
|
5
5
|
// (jest.cjs) and the reporter (jestReporter.mjs). Nothing of the user's is
|
|
6
6
|
// replaced: their setup files and reporters keep running.
|
|
7
|
-
import { realpathSync } from "node:fs";
|
|
7
|
+
import { readFileSync, realpathSync } from "node:fs";
|
|
8
8
|
import { createRequire } from "node:module";
|
|
9
9
|
import { dirname, resolve } from "node:path";
|
|
10
10
|
import { fileURLToPath } from "node:url";
|
|
@@ -32,7 +32,8 @@ function jestConfig() {
|
|
|
32
32
|
let first;
|
|
33
33
|
for (const base of bases) {
|
|
34
34
|
try {
|
|
35
|
-
|
|
35
|
+
const path = base.resolve("jest-config");
|
|
36
|
+
return { module: base(path), path };
|
|
36
37
|
} catch (error) {
|
|
37
38
|
first ??= error;
|
|
38
39
|
}
|
|
@@ -40,17 +41,55 @@ function jestConfig() {
|
|
|
40
41
|
throw first;
|
|
41
42
|
}
|
|
42
43
|
|
|
44
|
+
// The project's own options, unnormalized, as Jest 29.3 and later read them
|
|
45
|
+
// (`readInitialOptions`). Earlier Jest (27, 28) has the same two steps as
|
|
46
|
+
// modules of its build, which its package's exports hide from a require by
|
|
47
|
+
// name: they are required beside its entry.
|
|
48
|
+
async function readProjectOptions(original) {
|
|
49
|
+
const { module, path } = jestConfig();
|
|
50
|
+
if (typeof module.readInitialOptions === "function")
|
|
51
|
+
return module.readInitialOptions(original, { skipMultipleConfigError: true });
|
|
52
|
+
if (original && module.isJSONString?.(original))
|
|
53
|
+
return { config: JSON.parse(original), configPath: null };
|
|
54
|
+
const internal = createRequire(path);
|
|
55
|
+
const step = (name) => {
|
|
56
|
+
const loaded = internal(`./${name}`);
|
|
57
|
+
return loaded.default ?? loaded;
|
|
58
|
+
};
|
|
59
|
+
const configPath = step("resolveConfigPath")(original ?? process.cwd(), process.cwd(), true);
|
|
60
|
+
const config = await step("readConfigFileAndSetRootDir")(configPath);
|
|
61
|
+
return { config, configPath };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// A strong pass's job (strongJob.mjs) runs one of the run's test files: the
|
|
65
|
+
// run's others are left out as Jest finds them.
|
|
66
|
+
function strongJobFiles(config) {
|
|
67
|
+
const path = process.env["SUPERCOV_STRONG_JOB"];
|
|
68
|
+
if (!path)
|
|
69
|
+
return {};
|
|
70
|
+
let spec;
|
|
71
|
+
try {
|
|
72
|
+
spec = JSON.parse(readFileSync(path, "utf8"));
|
|
73
|
+
} catch {
|
|
74
|
+
return {};
|
|
75
|
+
}
|
|
76
|
+
const running = new Set(Object.keys(spec.files ?? {}));
|
|
77
|
+
const escape = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
78
|
+
const left = (spec.known ?? []).filter((file) => !running.has(file))
|
|
79
|
+
.map((file) => `^${escape(resolve(process.cwd(), file))}$`);
|
|
80
|
+
return { testPathIgnorePatterns: [...asList(config.testPathIgnorePatterns ?? "/node_modules/"), ...left] };
|
|
81
|
+
}
|
|
82
|
+
|
|
43
83
|
export default async function supercovJestConfig() {
|
|
44
84
|
let config = { rootDir: process.cwd() };
|
|
45
85
|
try {
|
|
46
|
-
const { readInitialOptions } = jestConfig();
|
|
47
86
|
const original = process.env["SUPERCOV_ORIGINAL_JEST_CONFIG"] || undefined;
|
|
48
|
-
const read = await
|
|
87
|
+
const read = await readProjectOptions(original);
|
|
49
88
|
config = read.config ?? config;
|
|
50
89
|
config.rootDir ??= read.configPath ? dirname(read.configPath) : process.cwd();
|
|
51
90
|
} catch (error) {
|
|
52
|
-
//
|
|
53
|
-
//
|
|
91
|
+
// A configuration Jest itself could not read either, or a Jest
|
|
92
|
+
// whose jest-config is not where Jest 27-30 keep it.
|
|
54
93
|
process.emitWarning(`[supercov] the project's Jest configuration was not read (${error?.message ?? error}); Jest's defaults apply`);
|
|
55
94
|
}
|
|
56
95
|
// Jest's coverage measures the instrumented copy, probes included, and a
|
|
@@ -63,6 +102,7 @@ export default async function supercovJestConfig() {
|
|
|
63
102
|
process.__SUPERCOV_SKIPPED_COVERAGE_THRESHOLDS__?.("Jest");
|
|
64
103
|
return {
|
|
65
104
|
...own,
|
|
105
|
+
...strongJobFiles(own),
|
|
66
106
|
// Concurrent tests in one file would share the worker's scope.
|
|
67
107
|
maxConcurrency: 1,
|
|
68
108
|
setupFiles: [here("jestRuntime.cjs"), ...asList(config.setupFiles)],
|
|
@@ -54,7 +54,9 @@ export default class SupercovJestReporter {
|
|
|
54
54
|
explicitKind: process.env["SUPERCOV_TEST_KIND"],
|
|
55
55
|
tags: testTags(undefined, [result.fullName]),
|
|
56
56
|
});
|
|
57
|
-
|
|
57
|
+
// How long the test took, where Jest says: a strong pass runs a
|
|
58
|
+
// mutant's cheapest test files first, and gives each its limit.
|
|
59
|
+
const record = (attempt, attemptStatus, flaky, duration) => {
|
|
58
60
|
const payload = {
|
|
59
61
|
testId,
|
|
60
62
|
// Named by its describe blocks, `small > charges`, as every
|
|
@@ -66,6 +68,7 @@ export default class SupercovJestReporter {
|
|
|
66
68
|
status: attemptStatus,
|
|
67
69
|
expectedStatus: "passed",
|
|
68
70
|
flaky,
|
|
71
|
+
...(typeof duration === "number" && duration >= 0 ? { durationMs: Math.round(duration) } : {}),
|
|
69
72
|
provenance,
|
|
70
73
|
runtime: [],
|
|
71
74
|
browser: [],
|
|
@@ -78,7 +81,7 @@ export default class SupercovJestReporter {
|
|
|
78
81
|
// adapter wrote each attempt's coverage without an outcome.
|
|
79
82
|
for (let attempt = 0; attempt < retry; attempt += 1)
|
|
80
83
|
record(attempt, "failed", false);
|
|
81
|
-
record(retry, status, retry > 0 && status === "passed");
|
|
84
|
+
record(retry, status, retry > 0 && status === "passed", result.duration);
|
|
82
85
|
}
|
|
83
86
|
// Jest calls these on every reporter.
|
|
84
87
|
onRunComplete() { }
|