supercov 0.0.32 → 0.0.34
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 +2 -1
- package/docs/getting-started.md +6 -2
- package/docs/supported-suites.md +79 -1
- package/docs/troubleshooting.md +15 -0
- package/package.json +14 -11
- package/runtime/javascript/{nodeAssert.js → nodeAssert.mjs} +1 -1
- package/runtime/javascript/{nodeAssertAdapter.js → nodeAssertAdapter.mjs} +1 -1
- package/runtime/javascript/{nodeAssertStrict.js → nodeAssertStrict.mjs} +1 -1
- package/runtime/javascript/{nodeTest.js → nodeTest.mjs} +3 -3
- package/runtime/javascript/{playwright.js → playwright.mjs} +4 -4
- package/runtime/javascript/{playwrightReporter.js → playwrightReporter.mjs} +2 -2
- package/runtime/javascript/register.mjs +7 -7
- package/runtime/javascript/resolve-loader.mjs +5 -5
- package/runtime/javascript/{runnerEvidence.js → runnerEvidence.mjs} +3 -3
- package/runtime/javascript/{vitest.js → vitest.mjs} +3 -3
- package/runtime/javascript/{vitestReporter.js → vitestReporter.mjs} +2 -2
- /package/runtime/javascript/{atomic.js → atomic.mjs} +0 -0
- /package/runtime/javascript/{capability.js → capability.mjs} +0 -0
- /package/runtime/javascript/{launchSupervisor.js → launchSupervisor.mjs} +0 -0
- /package/runtime/javascript/{provenance.js → provenance.mjs} +0 -0
- /package/runtime/javascript/{runtime.js → runtime.mjs} +0 -0
- /package/runtime/javascript/{transport.js → transport.mjs} +0 -0
package/README.md
CHANGED
|
@@ -109,11 +109,12 @@ The denominator comes from source structure before the run, so adding or removin
|
|
|
109
109
|
| TypeScript | Available | `npx supercov -- npm test` |
|
|
110
110
|
| Rust | Available | `npx supercov -- cargo test` |
|
|
111
111
|
| Python | Available | `npx supercov -- pytest` |
|
|
112
|
+
| Ruby | Available | `npx supercov -- rspec` |
|
|
112
113
|
| Zig | Coming soon | — |
|
|
113
114
|
| PHP | Coming soon | — |
|
|
114
115
|
| C | Coming soon | — |
|
|
115
116
|
|
|
116
|
-
Supercov requires Node.js 22 or newer. Rust support currently uses Rust 1.95; cargo-nextest 0.9.138 and 0.9.140 are supported. Python support requires CPython 3.12 or newer and measures pytest and unittest runs.
|
|
117
|
+
Supercov requires Node.js 22 or newer. Rust support currently uses Rust 1.95; cargo-nextest 0.9.138 and 0.9.140 are supported. Python support requires CPython 3.12 or newer and measures pytest and unittest runs. Ruby support requires Ruby 3.3 or newer (3.4 or newer for full measurement) and measures RSpec, Minitest, test-unit and Cucumber runs.
|
|
117
118
|
|
|
118
119
|
## Supported test suites
|
|
119
120
|
|
package/docs/getting-started.md
CHANGED
|
@@ -9,7 +9,7 @@ npx supercov -- npm test
|
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
No account, config file, import, custom reporter, or hosted service is required.
|
|
12
|
-
Supercov supports JavaScript, TypeScript, Rust, and
|
|
12
|
+
Supercov supports JavaScript, TypeScript, Rust, Python, and Ruby today.
|
|
13
13
|
|
|
14
14
|
## Before you start
|
|
15
15
|
|
|
@@ -18,7 +18,8 @@ You need:
|
|
|
18
18
|
- Node.js 22 or newer;
|
|
19
19
|
- a test command that already works in the repository; and
|
|
20
20
|
- for Rust, the Rust 1.95 toolchain;
|
|
21
|
-
- for Python, CPython 3.12 or newer with pytest or unittest
|
|
21
|
+
- for Python, CPython 3.12 or newer with pytest or unittest;
|
|
22
|
+
- for Ruby, Ruby 3.4 or newer with RSpec, Minitest, test-unit or Cucumber (3.3 measures lines, methods and simple branches only).
|
|
22
23
|
|
|
23
24
|
The CLI is distributed through npm, even for Rust projects. The first `npx`
|
|
24
25
|
invocation may download Supercov from the npm registry. Supercov itself does not
|
|
@@ -41,6 +42,9 @@ npx supercov -- cargo nextest run
|
|
|
41
42
|
|
|
42
43
|
# Python
|
|
43
44
|
npx supercov -- pytest
|
|
45
|
+
|
|
46
|
+
# Ruby
|
|
47
|
+
npx supercov -- rspec
|
|
44
48
|
```
|
|
45
49
|
|
|
46
50
|
Supercov runs that command in an isolated, instrumented copy of the project.
|
package/docs/supported-suites.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Supported languages and test suites
|
|
2
2
|
|
|
3
|
-
Supercov supports JavaScript, TypeScript, Rust, and
|
|
3
|
+
Supercov supports JavaScript, TypeScript, Rust, Python, and Ruby today. Start with
|
|
4
4
|
the same test command the repository already uses; Supercov detects supported
|
|
5
5
|
runners inside that command.
|
|
6
6
|
|
|
@@ -9,6 +9,7 @@ npx supercov -- npm test
|
|
|
9
9
|
npx supercov -- npx playwright test
|
|
10
10
|
npx supercov -- cargo test
|
|
11
11
|
npx supercov -- pytest
|
|
12
|
+
npx supercov -- rspec
|
|
12
13
|
```
|
|
13
14
|
|
|
14
15
|
## Language support
|
|
@@ -19,6 +20,7 @@ npx supercov -- pytest
|
|
|
19
20
|
| TypeScript | Available | `npx supercov -- npm test` |
|
|
20
21
|
| Rust | Available | `npx supercov -- cargo test` |
|
|
21
22
|
| Python | Available | `npx supercov -- pytest` |
|
|
23
|
+
| Ruby | Available | `npx supercov -- rspec` |
|
|
22
24
|
| Zig | Coming soon | — |
|
|
23
25
|
| PHP | Coming soon | — |
|
|
24
26
|
| C | Coming soon | — |
|
|
@@ -137,6 +139,82 @@ npx supercov -- uv run pytest
|
|
|
137
139
|
npx supercov -- python -m unittest
|
|
138
140
|
```
|
|
139
141
|
|
|
142
|
+
## Ruby
|
|
143
|
+
|
|
144
|
+
| Runner | Attribution | Current requirement |
|
|
145
|
+
| --- | --- | --- |
|
|
146
|
+
| 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` |
|
|
147
|
+
| Minitest (including Minitest::Spec and ActiveSupport::TestCase) | Exact test and setup/test/teardown identity; skips recorded | `ruby -Itest ...`, `rake test`, `rails test` |
|
|
148
|
+
| test-unit | Exact test and setup/test/teardown identity; omissions and pendings recorded | `ruby -Itest ...`, `rake test` |
|
|
149
|
+
| 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 |
|
|
150
|
+
| 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 | |
|
|
151
|
+
| Cucumber | Exact scenario identity (`features/x.feature:LINE`), hook steps as setup/teardown | `cucumber`, `bundle exec cucumber` |
|
|
152
|
+
|
|
153
|
+
Supercov measures Ruby with Ruby's own `Coverage` module plus probe calls it
|
|
154
|
+
splices into application files in memory as they load. Nothing on disk is
|
|
155
|
+
rewritten or copied; the project runs with its own interpreter and bundle, and
|
|
156
|
+
Supercov only adds a `-r` entry to `RUBYOPT` and a few `SUPERCOV_*` variables.
|
|
157
|
+
No insertion adds a line, so backtraces keep their line numbers.
|
|
158
|
+
|
|
159
|
+
Measured obligations are statements, method definitions, `if`/`unless`/
|
|
160
|
+
ternary/`while`/`until` decisions with MC/DC vectors over `&&`/`||` operands,
|
|
161
|
+
`while`/`until`/`for` iteration and the idiomatic iterator blocks (`each`,
|
|
162
|
+
`map`, `times`, `select`, ...), `&&`/`||`/`||=`/`&&=` short-circuiting,
|
|
163
|
+
`case`/`when`, `case`/`in` and `&.` selection, and `begin`/`rescue` completion,
|
|
164
|
+
handler selection and propagation. `||=` and `&&=` on method-call, index and
|
|
165
|
+
constant targets are exact too: an arrival probe and a right-side probe count
|
|
166
|
+
the skipped side without re-reading the target. Blocks and lambdas are
|
|
167
|
+
statements inside their methods, not function entry points, and that includes
|
|
168
|
+
a `define_method` block: Ruby's own method coverage reports one entry per
|
|
169
|
+
method it defines, but the block's body is measured statement by statement
|
|
170
|
+
instead of as a definition.
|
|
171
|
+
|
|
172
|
+
A statement on a line Ruby's own line table never counts (`x = case`, a
|
|
173
|
+
multi-line literal assignment, a bare `begin`, `if false`) gets a probe at load
|
|
174
|
+
time instead.
|
|
175
|
+
`if true`/`if false`/`if nil` and other literal predicates are folded the way
|
|
176
|
+
Ruby folds them: no branch, and the dead arm is not an obligation. A Spring
|
|
177
|
+
preloader started before the run has no hook and fails closed; JRuby and
|
|
178
|
+
TruffleRuby are not supported.
|
|
179
|
+
|
|
180
|
+
The runtime loads through `RUBYOPT` before Bundler and requires only
|
|
181
|
+
`coverage`, so it never activates a gem an application's Gemfile pins
|
|
182
|
+
differently. Insertions are checked against Ruby itself by a sweep
|
|
183
|
+
(`scripts/ruby-position-sweep.rb`) over Ruby's whole standard library and the
|
|
184
|
+
Rails, Rack, RSpec, Minitest and Cucumber gems, about 3,000 files: every file
|
|
185
|
+
is transformed and compiled, and every position Supercov expects is compared
|
|
186
|
+
with what Ruby reports. With `--load` each file also runs twice, untouched and
|
|
187
|
+
transformed, so the probes are proven to preserve behaviour and every method
|
|
188
|
+
position is checked.
|
|
189
|
+
|
|
190
|
+
A `begin` whose body ends in an expression that can `return` from inside
|
|
191
|
+
itself has its handlers and propagation measured as usual, but its normal
|
|
192
|
+
completion is declared instead of probed unless every branch of that
|
|
193
|
+
expression can carry the probe: Ruby cannot pass such an expression as an
|
|
194
|
+
argument, which is what a probe wrapper does.
|
|
195
|
+
|
|
196
|
+
Measuring never breaks the program being measured. If a file cannot be
|
|
197
|
+
compiled with its probes, it loads unmodified: Ruby's `Coverage` still
|
|
198
|
+
measures its lines, methods and own branches, and only the obligations a
|
|
199
|
+
probe would have proven are declared for that file. Setting
|
|
200
|
+
`SUPERCOV_RUBY_SKIP_PROBES` to a comma-separated list of path fragments puts
|
|
201
|
+
chosen files on that same path deliberately, which is the escape hatch if
|
|
202
|
+
instrumentation ever disagrees with one of yours.
|
|
203
|
+
|
|
204
|
+
Ruby 3.3 does not apply its `Coverage` module to code compiled by a load hook,
|
|
205
|
+
so on 3.3 Supercov measures through `Coverage` alone: lines, methods and the
|
|
206
|
+
branches Ruby reports itself. Everything that needs a probe (multi-condition
|
|
207
|
+
decisions, `||=`, loops, `rescue` flow, a second statement on a line) is
|
|
208
|
+
declared unmeasured on that interpreter rather than shown as a gap. Ruby 3.4
|
|
209
|
+
and newer measure everything.
|
|
210
|
+
|
|
211
|
+
```sh
|
|
212
|
+
npx supercov -- rspec
|
|
213
|
+
npx supercov -- bundle exec rspec
|
|
214
|
+
npx supercov -- ruby -Itest test/shapes_test.rb
|
|
215
|
+
npx supercov -- bin/rails test
|
|
216
|
+
```
|
|
217
|
+
|
|
140
218
|
## Containers, VMs, and remote execution
|
|
141
219
|
|
|
142
220
|
Supercov can collect from supported processes launched through a container, VM,
|
package/docs/troubleshooting.md
CHANGED
|
@@ -60,6 +60,21 @@ Compare the command with [Supported suites](supported-suites.md). If the runner
|
|
|
60
60
|
should be supported, preserve the summary and exact command when reporting the
|
|
61
61
|
problem.
|
|
62
62
|
|
|
63
|
+
## A Ruby file behaves differently while Supercov measures it
|
|
64
|
+
|
|
65
|
+
Supercov splices probe calls into Ruby sources in memory as they load, and a
|
|
66
|
+
file that cannot be compiled with them is measured through Ruby's `Coverage`
|
|
67
|
+
module alone rather than failing the run. To put a file on that path
|
|
68
|
+
deliberately, name a fragment of its path:
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
SUPERCOV_RUBY_SKIP_PROBES=app/models/order.rb npx supercov -- bundle exec rspec
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Its lines, methods and simple branches stay measured; everything that needs a
|
|
75
|
+
probe is declared as a measurement limit for that file. Please report the file,
|
|
76
|
+
since Supercov aims to instrument every Ruby source correctly.
|
|
77
|
+
|
|
63
78
|
## A run is marked stale
|
|
64
79
|
|
|
65
80
|
A stored run remains valid history, but it stops describing the current
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "supercov",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.34",
|
|
4
4
|
"description": "Zero-edit, runner-aware coverage completeness for JavaScript, TypeScript, Rust, and Python test suites",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
30
|
"exports": {
|
|
31
|
-
"./playwright": "./runtime/javascript/playwright.
|
|
31
|
+
"./playwright": "./runtime/javascript/playwright.mjs",
|
|
32
32
|
"./register": "./runtime/javascript/register.mjs",
|
|
33
|
-
"./vitest": "./runtime/javascript/vitest.
|
|
33
|
+
"./vitest": "./runtime/javascript/vitest.mjs"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "cargo build -p supercov",
|
|
@@ -64,18 +64,21 @@
|
|
|
64
64
|
"benchmark:check": "cargo build --release -p supercov && node scripts/rust-transform-benchmark.mjs",
|
|
65
65
|
"benchmark:python-monitoring": "cargo build -p supercov && node scripts/python-monitoring-benchmark.mjs",
|
|
66
66
|
"check": "cargo fmt --all -- --check && cargo clippy --workspace --all-targets -- -D warnings && npm run test && npm run test:runtime && npm run test:rust-assets && node scripts/package-preflight.mjs",
|
|
67
|
-
"release:check": "npm run check && npm run test:engine && npm run test:fixture && npm run test:watchdog && npm run test:engine-contract && npm run test:agent && npm run test:python-monitoring && npm run test:packed-npx && npm run test:clang-mcdc && npm run benchmark:check",
|
|
67
|
+
"release:check": "npm run check && npm run test:engine && 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-monitoring && npm run test:ruby-coverage && npm run test:packed-npx && npm run test:clang-mcdc && npm run benchmark:check",
|
|
68
68
|
"prepack": "node scripts/package-preflight.mjs",
|
|
69
69
|
"prepublishOnly": "npm run release:check",
|
|
70
|
-
"test:
|
|
70
|
+
"test:child-attribution": "cargo build -p supercov && node scripts/rust-child-attribution-integration.mjs",
|
|
71
|
+
"test:host-loader": "cargo build -p supercov && node scripts/rust-host-loader-integration.mjs",
|
|
72
|
+
"test:python-monitoring": "cargo build -p supercov && node scripts/python-monitoring-integration.mjs",
|
|
73
|
+
"test:ruby-coverage": "cargo build -p supercov && node scripts/ruby-coverage-integration.mjs"
|
|
71
74
|
},
|
|
72
75
|
"optionalDependencies": {
|
|
73
|
-
"@supercov/cli-darwin-arm64": "0.0.
|
|
74
|
-
"@supercov/cli-darwin-x64": "0.0.
|
|
75
|
-
"@supercov/cli-linux-arm64-gnu": "0.0.
|
|
76
|
-
"@supercov/cli-linux-arm64-musl": "0.0.
|
|
77
|
-
"@supercov/cli-linux-x64-gnu": "0.0.
|
|
78
|
-
"@supercov/cli-linux-x64-musl": "0.0.
|
|
76
|
+
"@supercov/cli-darwin-arm64": "0.0.34",
|
|
77
|
+
"@supercov/cli-darwin-x64": "0.0.34",
|
|
78
|
+
"@supercov/cli-linux-arm64-gnu": "0.0.34",
|
|
79
|
+
"@supercov/cli-linux-arm64-musl": "0.0.34",
|
|
80
|
+
"@supercov/cli-linux-x64-gnu": "0.0.34",
|
|
81
|
+
"@supercov/cli-linux-x64-musl": "0.0.34"
|
|
79
82
|
},
|
|
80
83
|
"peerDependencies": {
|
|
81
84
|
"@playwright/test": ">=1.55.0",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import nativeAssert from "node:assert";
|
|
2
|
-
import { createNodeAssertAdapter, setStrictAssertAdapter } from "./nodeAssertAdapter.
|
|
2
|
+
import { createNodeAssertAdapter, setStrictAssertAdapter } from "./nodeAssertAdapter.mjs";
|
|
3
3
|
const adapter = createNodeAssertAdapter(nativeAssert, "node:assert");
|
|
4
4
|
const strictAdapter = createNodeAssertAdapter(nativeAssert.strict, "node:assert/strict");
|
|
5
5
|
setStrictAssertAdapter(adapter, strictAdapter);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import nativeAssert from "node:assert/strict";
|
|
2
|
-
import { createNodeAssertAdapter, setStrictAssertAdapter } from "./nodeAssertAdapter.
|
|
2
|
+
import { createNodeAssertAdapter, setStrictAssertAdapter } from "./nodeAssertAdapter.mjs";
|
|
3
3
|
const adapter = createNodeAssertAdapter(nativeAssert, "node:assert/strict");
|
|
4
4
|
setStrictAssertAdapter(adapter, adapter);
|
|
5
5
|
export default adapter;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as native from "node:test";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
import vm from "node:vm";
|
|
4
|
-
import { beginBufferedServerEvidence, flushBufferedServerEvidence, takeNodeAssertionPhases, withCoverageCarrier, } from "./runtime.
|
|
5
|
-
import { callerLocation, runnerExecutionScope, writeRunnerEvidence, } from "./runnerEvidence.
|
|
4
|
+
import { beginBufferedServerEvidence, flushBufferedServerEvidence, takeNodeAssertionPhases, withCoverageCarrier, } from "./runtime.mjs";
|
|
5
|
+
import { callerLocation, runnerExecutionScope, writeRunnerEvidence, } from "./runnerEvidence.mjs";
|
|
6
6
|
function callbackIndex(args) {
|
|
7
7
|
for (let index = args.length - 1; index >= 0; index -= 1)
|
|
8
8
|
if (typeof args[index] === "function")
|
|
@@ -18,7 +18,7 @@ function testOptions(args, index) {
|
|
|
18
18
|
}
|
|
19
19
|
// node:test derives a test's reported location from the direct caller of the
|
|
20
20
|
// registration call, and the adapter is that caller: every failing test
|
|
21
|
-
// reported "test at .../nodeTest.
|
|
21
|
+
// reported "test at .../nodeTest.mjs". A compiled trampoline carrying the
|
|
22
22
|
// user's call site as its script origin registers the test instead, so the
|
|
23
23
|
// runner sees the location a direct call would have produced. The padded
|
|
24
24
|
// second line puts the call expression at the user's exact line and column.
|
|
@@ -14,10 +14,10 @@ import https from "node:https";
|
|
|
14
14
|
import { syncBuiltinESMExports } from "node:module";
|
|
15
15
|
import { relative, resolve, sep } from "node:path";
|
|
16
16
|
import * as standardPlaywright from "@playwright/test";
|
|
17
|
-
import * as coverageRuntime from "./runtime.
|
|
18
|
-
import { inferTestProvenance } from "./provenance.
|
|
19
|
-
import { appendJsonLineDurableSync, appendJsonLineSync } from "./atomic.
|
|
20
|
-
import { COVERAGE_PHASE_HEADER, COVERAGE_PHASE_COOKIE, COVERAGE_SCOPE_COOKIE, COVERAGE_SCOPE_HEADER, COVERAGE_CARRIER_ENV, encodeCoverageCarrier, encodeCoverageScope, serverEvidenceDirectory, serverEvidencePath, } from "./transport.
|
|
17
|
+
import * as coverageRuntime from "./runtime.mjs";
|
|
18
|
+
import { inferTestProvenance } from "./provenance.mjs";
|
|
19
|
+
import { appendJsonLineDurableSync, appendJsonLineSync } from "./atomic.mjs";
|
|
20
|
+
import { COVERAGE_PHASE_HEADER, COVERAGE_PHASE_COOKIE, COVERAGE_SCOPE_COOKIE, COVERAGE_SCOPE_HEADER, COVERAGE_CARRIER_ENV, encodeCoverageCarrier, encodeCoverageScope, serverEvidenceDirectory, serverEvidencePath, } from "./transport.mjs";
|
|
21
21
|
export * from "@playwright/test";
|
|
22
22
|
const generatedTargetModule = "__SUPERCOV_PLAYWRIGHT_MODULE__";
|
|
23
23
|
const targetModule = process.env["SUPERCOV_PLAYWRIGHT_MODULE"] ??
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { relative, resolve, sep } from "node:path";
|
|
2
|
-
import { inferTestProvenance } from "./provenance.
|
|
3
|
-
import { appendJsonLineDurableSync, appendJsonLineSync } from "./atomic.
|
|
2
|
+
import { inferTestProvenance } from "./provenance.mjs";
|
|
3
|
+
import { appendJsonLineDurableSync, appendJsonLineSync } from "./atomic.mjs";
|
|
4
4
|
const GENERATED_EVIDENCE_DIRECTORY = "__SUPERCOV_EVIDENCE_DIRECTORY__";
|
|
5
5
|
const evidenceWriterIdentity = () => (process.env.SUPERCOV_EXECUTION_LOG_SHARD ?? `pid-${process.pid}`)
|
|
6
6
|
.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
@@ -9,8 +9,8 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
|
|
|
9
9
|
import Module, { register, syncBuiltinESMExports } from "node:module";
|
|
10
10
|
import { closeSync, openSync, unlinkSync } from "node:fs";
|
|
11
11
|
import { resolve } from "node:path";
|
|
12
|
-
import { installLaunchSupervisor, wrapImportedCapability } from "./launchSupervisor.
|
|
13
|
-
import { __supercovBindCapabilityWrapper } from "./capability.
|
|
12
|
+
import { installLaunchSupervisor, wrapImportedCapability } from "./launchSupervisor.mjs";
|
|
13
|
+
import { __supercovBindCapabilityWrapper } from "./capability.mjs";
|
|
14
14
|
installLaunchSupervisor();
|
|
15
15
|
// Instrumented sources import the browser-safe capability seam; bind the
|
|
16
16
|
// real supervisor implementation before any user module evaluates.
|
|
@@ -77,7 +77,7 @@ if (process.env.SUPERCOV_DURABLE_EVIDENCE_EACH_TEST === "1") {
|
|
|
77
77
|
// test through an opaque runner that bypasses the ordinary Playwright or
|
|
78
78
|
// node:test import boundary. The remote-launch adapter marks that process;
|
|
79
79
|
// initialize the runtime before its transformed module can evaluate.
|
|
80
|
-
globalThis.__SUPERCOV_DIRECT_RUNTIME__ ??= await import("./runtime.
|
|
80
|
+
globalThis.__SUPERCOV_DIRECT_RUNTIME__ ??= await import("./runtime.mjs");
|
|
81
81
|
process.__SUPERCOV_DIRECT_RUNTIME__ ??= globalThis.__SUPERCOV_DIRECT_RUNTIME__;
|
|
82
82
|
}
|
|
83
83
|
// Workers are independent Node processes and an explicit `execArgv: []`
|
|
@@ -119,9 +119,9 @@ const generatedJestConfig = process.env.SUPERCOV_GENERATED_JEST_CONFIG;
|
|
|
119
119
|
const entrypoint = process.argv[1]?.replaceAll("\\", "/") ?? "";
|
|
120
120
|
const playwrightTarget = process.env.SUPERCOV_PLAYWRIGHT_MODULE;
|
|
121
121
|
const projectRoot = process.env.SUPERCOV_PROJECT_ROOT?.replaceAll("\\", "/").replace(/\/$/, "");
|
|
122
|
-
const nodeTestWrapper = new URL("./nodeTest.
|
|
123
|
-
const nodeAssertWrapper = new URL("./nodeAssert.
|
|
124
|
-
const nodeAssertStrictWrapper = new URL("./nodeAssertStrict.
|
|
122
|
+
const nodeTestWrapper = new URL("./nodeTest.mjs", import.meta.url).href;
|
|
123
|
+
const nodeAssertWrapper = new URL("./nodeAssert.mjs", import.meta.url).href;
|
|
124
|
+
const nodeAssertStrictWrapper = new URL("./nodeAssertStrict.mjs", import.meta.url).href;
|
|
125
125
|
const isPlaywrightEntrypoint = /\/(?:node_modules\/\.bin\/playwright|node_modules\/(?:@playwright\/test|playwright)\/(?:cli\.js|.*\/program\.js))$/.test(entrypoint);
|
|
126
126
|
const isJestEntrypoint = /\/node_modules\/(?:\.bin\/jest|(?:jest|jest-cli)\/bin\/jest\.js)$/.test(entrypoint);
|
|
127
127
|
if (generatedPlaywrightConfig && isPlaywrightEntrypoint)
|
|
@@ -209,7 +209,7 @@ if (process.env.SUPERCOV_CJS_INTERCEPT === "1" &&
|
|
|
209
209
|
const projectRoot = process.env.SUPERCOV_PROJECT_ROOT;
|
|
210
210
|
const originalPlaywrightConfig = process.env.SUPERCOV_ORIGINAL_PLAYWRIGHT_CONFIG
|
|
211
211
|
?.replaceAll("\\", "/");
|
|
212
|
-
const wrapper = await import(__rewriteRelativeImportExtension(new URL("./playwright.
|
|
212
|
+
const wrapper = await import(__rewriteRelativeImportExtension(new URL("./playwright.mjs", import.meta.url)));
|
|
213
213
|
const originalLoad = Module._load;
|
|
214
214
|
Module._load = function supercovLoad(request, parent, isMain) {
|
|
215
215
|
const parentFile = parent?.filename?.replaceAll("\\", "/");
|
|
@@ -4,7 +4,7 @@ const GENERATED_TARGET = "__SUPERCOV_PLAYWRIGHT_MODULE__";
|
|
|
4
4
|
const TARGET = process.env.SUPERCOV_PLAYWRIGHT_MODULE ??
|
|
5
5
|
(GENERATED_TARGET.startsWith("__") ? "@playwright/test" : GENERATED_TARGET);
|
|
6
6
|
const REPLACEMENT = process.env.SUPERCOV_PLAYWRIGHT_WRAPPER ??
|
|
7
|
-
"./.supercov/node_modules/playwright.
|
|
7
|
+
"./.supercov/node_modules/playwright.mjs";
|
|
8
8
|
const PROJECT_ROOT = process.env.SUPERCOV_PROJECT_ROOT;
|
|
9
9
|
const ORIGINAL_CONFIG = process.env.SUPERCOV_ORIGINAL_PLAYWRIGHT_CONFIG;
|
|
10
10
|
function belongsToProject(parentURL) {
|
|
@@ -29,10 +29,10 @@ export async function resolve(specifier, context, nextResolve) {
|
|
|
29
29
|
// source-local copy keeps strict rootDir compilers happy; this fallback
|
|
30
30
|
// resolves the emitted import to Supercov's generated runtime without
|
|
31
31
|
// requiring the project's build to copy our helper directory.
|
|
32
|
-
if (specifier.endsWith("/.supercov/node_modules/runtime.
|
|
32
|
+
if (specifier.endsWith("/.supercov/node_modules/runtime.mjs") &&
|
|
33
33
|
belongsToProject(context.parentURL)) {
|
|
34
34
|
return {
|
|
35
|
-
url: new URL("./runtime.
|
|
35
|
+
url: new URL("./runtime.mjs", import.meta.url).href,
|
|
36
36
|
shortCircuit: true,
|
|
37
37
|
};
|
|
38
38
|
}
|
|
@@ -40,7 +40,7 @@ export async function resolve(specifier, context, nextResolve) {
|
|
|
40
40
|
(specifier === "node:test" || specifier === "test") &&
|
|
41
41
|
belongsToProject(context.parentURL)) {
|
|
42
42
|
return {
|
|
43
|
-
url: new URL("./nodeTest.
|
|
43
|
+
url: new URL("./nodeTest.mjs", import.meta.url).href,
|
|
44
44
|
shortCircuit: true,
|
|
45
45
|
};
|
|
46
46
|
}
|
|
@@ -48,7 +48,7 @@ export async function resolve(specifier, context, nextResolve) {
|
|
|
48
48
|
["assert", "node:assert", "assert/strict", "node:assert/strict"].includes(specifier) &&
|
|
49
49
|
belongsToProject(context.parentURL)) {
|
|
50
50
|
return {
|
|
51
|
-
url: new URL(specifier.endsWith("/strict") ? "./nodeAssertStrict.
|
|
51
|
+
url: new URL(specifier.endsWith("/strict") ? "./nodeAssertStrict.mjs" : "./nodeAssert.mjs", import.meta.url).href,
|
|
52
52
|
shortCircuit: true,
|
|
53
53
|
};
|
|
54
54
|
}
|
|
@@ -2,9 +2,9 @@ import { createHash, randomBytes } from "node:crypto";
|
|
|
2
2
|
import { mkdirSync, readFileSync } from "node:fs";
|
|
3
3
|
import { relative, resolve, sep } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { atomicWriteFileSync } from "./atomic.
|
|
6
|
-
import { inferTestProvenance } from "./provenance.
|
|
7
|
-
import { serverEvidencePath } from "./transport.
|
|
5
|
+
import { atomicWriteFileSync } from "./atomic.mjs";
|
|
6
|
+
import { inferTestProvenance } from "./provenance.mjs";
|
|
7
|
+
import { serverEvidencePath } from "./transport.mjs";
|
|
8
8
|
|
|
9
9
|
let cachedProcessInstanceToken;
|
|
10
10
|
function processInstanceToken() {
|
|
@@ -2,9 +2,9 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
import { mkdirSync } from "node:fs";
|
|
3
3
|
import { relative, resolve, sep } from "node:path";
|
|
4
4
|
import { afterEach, beforeEach } from "vitest";
|
|
5
|
-
import { coverageSnapshot as localCoverageSnapshot, activateCoverageScope as localActivateCoverageScope, enableRuntimeSnapshotEvidence as localEnableRuntimeSnapshotEvidence, resetCoverage as localResetCoverage, takeNodeAssertionPhases as localTakeNodeAssertionPhases, } from "./runtime.
|
|
6
|
-
import { inferTestProvenance } from "./provenance.
|
|
7
|
-
import { atomicWriteFileSync } from "./atomic.
|
|
5
|
+
import { coverageSnapshot as localCoverageSnapshot, activateCoverageScope as localActivateCoverageScope, enableRuntimeSnapshotEvidence as localEnableRuntimeSnapshotEvidence, resetCoverage as localResetCoverage, takeNodeAssertionPhases as localTakeNodeAssertionPhases, } from "./runtime.mjs";
|
|
6
|
+
import { inferTestProvenance } from "./provenance.mjs";
|
|
7
|
+
import { atomicWriteFileSync } from "./atomic.mjs";
|
|
8
8
|
const evidenceDirectory = process.env["SUPERCOV_EVIDENCE_DIR"];
|
|
9
9
|
const emittedSetupFiles = new Set();
|
|
10
10
|
const attempts = new Map();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { mkdirSync } from "node:fs";
|
|
2
2
|
import { relative, resolve, sep } from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
-
import { inferTestProvenance } from "./provenance.
|
|
5
|
-
import { atomicWriteFileSync } from "./atomic.
|
|
4
|
+
import { inferTestProvenance } from "./provenance.mjs";
|
|
5
|
+
import { atomicWriteFileSync } from "./atomic.mjs";
|
|
6
6
|
function sourcePath(moduleId) {
|
|
7
7
|
const absolute = moduleId.startsWith("file:")
|
|
8
8
|
? fileURLToPath(moduleId)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|