supercov 0.0.44 → 0.0.46
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 +21 -12
- package/docs/agent-loop.md +17 -9
- package/docs/assertion-agent.md +146 -0
- package/docs/assertion-evidence.md +72 -663
- package/docs/assertion-maps.md +236 -0
- package/docs/assertions.md +132 -0
- package/docs/cli.md +40 -8
- package/docs/coverage-model.md +18 -0
- package/docs/evidence.md +28 -0
- package/docs/performance.md +16 -0
- package/docs/supported-suites.md +64 -147
- package/package.json +36 -35
- package/runtime/javascript/launchSupervisor.mjs +5 -0
- package/runtime/javascript/nodeTest.mjs +57 -41
- package/runtime/javascript/provenance.mjs +4 -1
- package/runtime/javascript/register.mjs +9 -5
- package/runtime/javascript/runnerEvidence.mjs +4 -1
- package/runtime/javascript/runtime.mjs +62 -36
- package/schemas/assertions.schema.json +276 -0
- package/analyzers/typescript/README.md +0 -59
- package/analyzers/typescript/bin/compiler-identity.mjs +0 -78
- package/analyzers/typescript/bin/identity.mjs +0 -71
- package/analyzers/typescript/bin/query.mjs +0 -29
- package/analyzers/typescript/dist/analyze.js +0 -5273
- package/analyzers/typescript/dist/archive.js +0 -337
- package/analyzers/typescript/dist/awaited-observations.js +0 -376
- package/analyzers/typescript/dist/build-identity.json +0 -1
- package/analyzers/typescript/dist/compiler.js +0 -32
- package/analyzers/typescript/dist/frontend.js +0 -75
- package/analyzers/typescript/dist/mock-counts.js +0 -2517
- package/analyzers/typescript/dist/native-frontend.js +0 -271
- package/analyzers/typescript/dist/pragmas.js +0 -186
- package/analyzers/typescript/dist/types.js +0 -1
- package/analyzers/typescript/package.json +0 -27
- package/analyzers/typescript/src/analyze.ts +0 -6180
- package/analyzers/typescript/src/archive.ts +0 -471
- package/analyzers/typescript/src/awaited-observations.ts +0 -561
- package/analyzers/typescript/src/compiler.ts +0 -49
- package/analyzers/typescript/src/frontend.ts +0 -136
- package/analyzers/typescript/src/mock-counts.ts +0 -3219
- package/analyzers/typescript/src/native-frontend.ts +0 -315
- package/analyzers/typescript/src/pragmas.ts +0 -284
- package/analyzers/typescript/src/types.ts +0 -45
- package/analyzers/typescript/tsconfig.json +0 -12
- package/docs/code-verification.md +0 -4
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# Assertion map format
|
|
2
|
+
|
|
3
|
+
Edit a run's `assertions.json` to record which assertions check which source
|
|
4
|
+
statements. Start with [Understanding assertion coverage](assertions.md) if you
|
|
5
|
+
want an agent to create the map for you. This reference covers the fields and
|
|
6
|
+
commands used to inspect, update and validate it.
|
|
7
|
+
|
|
8
|
+
## Open the run's map
|
|
9
|
+
|
|
10
|
+
```sh supercov
|
|
11
|
+
npx supercov runs latest assertions --json
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The response gives you `data.run` and `data.map`. Use that run ID throughout the
|
|
15
|
+
edit. A normal run creates the file automatically and inherits compatible work
|
|
16
|
+
from earlier runs of the same test command and language.
|
|
17
|
+
|
|
18
|
+
Only edit `assertions.json`. Keep `assertions.state.json` and the run's evidence
|
|
19
|
+
unchanged. Use current project files that match the run when investigating.
|
|
20
|
+
|
|
21
|
+
## Describe an assertion and its flow
|
|
22
|
+
|
|
23
|
+
This illustrative draft maps an equality check to a return statement:
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"schemaVersion": 2,
|
|
28
|
+
"assertions": [{
|
|
29
|
+
"id": "a_example",
|
|
30
|
+
"at": {
|
|
31
|
+
"file": "tests/value.test.ts",
|
|
32
|
+
"line": 5,
|
|
33
|
+
"column": 3,
|
|
34
|
+
"text": "assert.equal(value(), 1)"
|
|
35
|
+
},
|
|
36
|
+
"observes": ["The returned number equals one."],
|
|
37
|
+
"flows": [{
|
|
38
|
+
"id": "return-value",
|
|
39
|
+
"basis": null,
|
|
40
|
+
"appliesTo": [{ "file": "tests/value.test.ts", "name": "value" }],
|
|
41
|
+
"explanation": "value() returns the number compared by the assertion.",
|
|
42
|
+
"nodes": [{
|
|
43
|
+
"id": "return",
|
|
44
|
+
"at": {
|
|
45
|
+
"file": "src/value.ts",
|
|
46
|
+
"line": 2,
|
|
47
|
+
"column": 3,
|
|
48
|
+
"text": "return 1;"
|
|
49
|
+
}
|
|
50
|
+
}],
|
|
51
|
+
"edges": [{ "from": "return", "to": "$assertion", "kind": "data" }],
|
|
52
|
+
"countsAsAsserted": ["return"],
|
|
53
|
+
"watch": []
|
|
54
|
+
}]
|
|
55
|
+
}]
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Use the actual assertion IDs, test names and source locations from your run.
|
|
60
|
+
The example remains a draft until its references match and its flow has been
|
|
61
|
+
examined and acknowledged.
|
|
62
|
+
|
|
63
|
+
| Field | What to write |
|
|
64
|
+
| --- | --- |
|
|
65
|
+
| Assertion `id`, `at` | Preserve the assertion's ID and exact test expression. |
|
|
66
|
+
| `observes` | Describe the property checked, such as an exact value, length or substring. |
|
|
67
|
+
| `flows` | Explain the routes from relevant source to this assertion. An empty array means no explanations are recorded. |
|
|
68
|
+
| Flow `id` | Choose a stable name within the assertion, such as `return-value`. |
|
|
69
|
+
| Flow `basis` | Start with `null`. After review, copy the token returned by validation. |
|
|
70
|
+
| `appliesTo` | Select tests by project-relative file and exact displayed test name. |
|
|
71
|
+
| `nodes`, `edges` | Record source locations and relationships ending at `$assertion`. |
|
|
72
|
+
| `countsAsAsserted` | List the node IDs you judge to be checked by the assertion. |
|
|
73
|
+
| `watch` | List additional files the explanation depends on, such as helpers or configuration. |
|
|
74
|
+
| `questions` | Record unresolved investigation questions. Questions inside a flow block its credit. |
|
|
75
|
+
|
|
76
|
+
Source anchors use project-relative paths with `/`, one-based lines and one-based
|
|
77
|
+
UTF-8 byte columns. Preserve exact text, including multiline expressions. IDs
|
|
78
|
+
use letters, digits, `_`, `-` or `.`. Edge `basis` is optional explanatory text;
|
|
79
|
+
it is separate from the flow's review token.
|
|
80
|
+
|
|
81
|
+
Every counted node needs a path through the recorded edges to `$assertion` and
|
|
82
|
+
must match a measured statement exactly. Counting an `if` statement does not
|
|
83
|
+
also count every statement inside it. Nodes that only provide context can stay
|
|
84
|
+
in the graph without appearing in `countsAsAsserted`.
|
|
85
|
+
|
|
86
|
+
Test selectors must be unambiguous. An empty `appliesTo` supplies no execution
|
|
87
|
+
credit. For a shared assertion, select the applicable test cases explicitly.
|
|
88
|
+
An absence or fixture-only check can use `countsAsAsserted: []`; explain what
|
|
89
|
+
was observed and, for absence, the ordering and observation window.
|
|
90
|
+
|
|
91
|
+
## Validate and acknowledge your edits
|
|
92
|
+
|
|
93
|
+
```sh supercov-example
|
|
94
|
+
npx supercov assertions schema --json
|
|
95
|
+
npx supercov assertions validate --file <map-path> --json
|
|
96
|
+
npx supercov runs <run-id> assertions validate --json
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The first command exports the editor schema. File validation checks JSON shape.
|
|
100
|
+
Run validation also checks IDs, source anchors, graph links, selected tests and
|
|
101
|
+
changed inputs. It does not edit the map or prove the explanation.
|
|
102
|
+
|
|
103
|
+
After examining a flow, copy its returned `expectedBasis` into that flow's
|
|
104
|
+
`basis`, save the file, and run `check`. Treat the token as an opaque value;
|
|
105
|
+
do not generate it yourself. Editing a claim or its dependencies makes the old
|
|
106
|
+
token stale.
|
|
107
|
+
|
|
108
|
+
```sh supercov-example
|
|
109
|
+
npx supercov runs <run-id> assertions check --require-mappings
|
|
110
|
+
npx supercov runs <run-id>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
| Check option | Requirement |
|
|
114
|
+
| --- | --- |
|
|
115
|
+
| No extra option | Authored claims and references are valid and current, questions and change assessments are resolved, and the run passed. Untouched assertions without flows are allowed. |
|
|
116
|
+
| `--require-mappings` | Every recognized assertion observed passing has a current explanation, including legitimate zero-credit explanations. |
|
|
117
|
+
| `--require-observed` | Every listed assertion and explicit test selector has matching passing evidence. |
|
|
118
|
+
| `--min <percentage>` | The available assertion percentage meets your target. |
|
|
119
|
+
|
|
120
|
+
Use `--require-observed` when every mapped site is expected to run. Skipped,
|
|
121
|
+
TODO and untaken cases can make it fail even when their explanations are useful.
|
|
122
|
+
Neither gate establishes that every possible flow has been found.
|
|
123
|
+
|
|
124
|
+
`validate` exits with code 2 for syntax or reference errors. A null or stale
|
|
125
|
+
review token alone is not a syntax error. `check` exits with code 2 when a
|
|
126
|
+
requested requirement is unmet.
|
|
127
|
+
|
|
128
|
+
## Understand statement credit
|
|
129
|
+
|
|
130
|
+
The percentage counts the union of explicitly claimed measured statements with
|
|
131
|
+
current flows, a passing assertion and execution in the same selected passing
|
|
132
|
+
test. Duplicate claims count once. Unexecuted statements remain in the
|
|
133
|
+
denominator. A line receives assertion credit only when all measured statements
|
|
134
|
+
on it receive credit.
|
|
135
|
+
|
|
136
|
+
TypeScript imports known to disappear during compilation are excluded. Inspect
|
|
137
|
+
their locations with:
|
|
138
|
+
|
|
139
|
+
```sh supercov-example
|
|
140
|
+
npx supercov runs <run-id> assertions report --view excludedStatements
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
This includes explicit `import type` and, for supported tsc/tsx/ts-node settings,
|
|
144
|
+
imports used only as types. Runtime, mixed and side-effect imports remain.
|
|
145
|
+
Preserving compiler settings and configurations that Supercov cannot resolve
|
|
146
|
+
keep ambiguous imports in the denominator. Older runs keep their recorded totals.
|
|
147
|
+
|
|
148
|
+
An assertion detail explains each node's credit decision. In JSON, computed
|
|
149
|
+
`nodeCredit` entries include the decision, reason codes, matched statement IDs
|
|
150
|
+
and matching tests. Keep these report fields out of the editable map. See
|
|
151
|
+
[Investigating assertion evidence](assertion-evidence.md) for missing execution,
|
|
152
|
+
shared setup and asynchronous cases.
|
|
153
|
+
|
|
154
|
+
A numeric result can come from a partial map. `current` means the flow has no
|
|
155
|
+
freshness, reference or question blockers; it does not mean all source nodes
|
|
156
|
+
receive credit or every relevant flow is known. The normal report shows counts
|
|
157
|
+
of assertions without flows and flows still needing attention beside the score.
|
|
158
|
+
|
|
159
|
+
JSON regular reports put the summary at `data.assertionCoverage.summary`.
|
|
160
|
+
Assertion reports use `data.summary`. A `summary.status` of `available` supplies
|
|
161
|
+
a percentage; `notAssessed`, `pending`, `unavailable` and `notApplicable` do not.
|
|
162
|
+
The assertion summary always covers the whole run, even when other coverage
|
|
163
|
+
metrics or the returned items are filtered.
|
|
164
|
+
|
|
165
|
+
## Find the next part to investigate
|
|
166
|
+
|
|
167
|
+
| Command after `supercov runs <run-id>` | Shows |
|
|
168
|
+
| --- | --- |
|
|
169
|
+
| `assertions` | Assertions, including those without recorded flows. |
|
|
170
|
+
| `assertions --needs-attention` | Missing explanations, questions, stale or draft flows, and claimed nodes without credit. |
|
|
171
|
+
| `assertion <id>` | One assertion, its flows and node-credit reasons. |
|
|
172
|
+
| `source <path>` | Matching current code with line numbers. |
|
|
173
|
+
| `assertions files` | Captured input paths, sizes and hashes, even if the checkout is stale. |
|
|
174
|
+
| `assertions report --view <view>` | `summary`, `assertions`, `statements`, `tests`, `changes`, `creditedLines`, `unassertedLines` or `excludedStatements`. |
|
|
175
|
+
|
|
176
|
+
Use `--file <path>` to filter applicable list views; the summary still describes
|
|
177
|
+
the whole run. Lists support `--offset`, `--limit` and `--json`. Follow the
|
|
178
|
+
printed next-page command or JSON `pagination.nextOffset` until it is null.
|
|
179
|
+
Restart a paged read if `revision` changes while you are reading it.
|
|
180
|
+
|
|
181
|
+
An assertion detail pages whole flows by default. For a large individual flow,
|
|
182
|
+
use `--flow <flow-id> --view nodes` and `--view edges`. Add `--compact` to omit
|
|
183
|
+
repeated source text while retaining locations. Read that text with `source`;
|
|
184
|
+
do not save compact report objects into the map.
|
|
185
|
+
|
|
186
|
+
Large validation results support `--view flows`, `--view changes` or
|
|
187
|
+
`--view errors`. Each page still reports validity for the entire map. The source
|
|
188
|
+
command pages lines; JSON source output uses `{line, text}` objects for integrations.
|
|
189
|
+
|
|
190
|
+
## Update the map after a change
|
|
191
|
+
|
|
192
|
+
Run the same test command again, then edit the new run's map. Supercov carries
|
|
193
|
+
forward compatible mappings and leaves the previous run unchanged. If a newer
|
|
194
|
+
map cannot be reused, `inheritance.skipped` explains the fallback.
|
|
195
|
+
|
|
196
|
+
Each flow depends on its assertion file, selected test files, node files and
|
|
197
|
+
extra `watch` files. A change to any of those files requires another look at that
|
|
198
|
+
flow, even if only a comment changed. Independent sibling flows can stay current.
|
|
199
|
+
Changing the assertion or its observation affects all its flows. Dependency,
|
|
200
|
+
configuration and instrumentation changes can affect many flows.
|
|
201
|
+
|
|
202
|
+
Start with `assertions report --view changes`. Investigate every listed change,
|
|
203
|
+
including effects on flows that did not yet watch the changed file. Add a
|
|
204
|
+
response in the map's top-level `changeAssessments` array:
|
|
205
|
+
|
|
206
|
+
```json
|
|
207
|
+
{
|
|
208
|
+
"changeAssessments": [{
|
|
209
|
+
"id": "c_copy_from_changes_view",
|
|
210
|
+
"basis": null,
|
|
211
|
+
"affectedFlows": ["a_example/return-value"],
|
|
212
|
+
"explanation": "The edit affects the returned value. The independent sibling calculation is unchanged."
|
|
213
|
+
}]
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
This is an excerpt to add to your existing map. Include every entry in `knownFlows`
|
|
218
|
+
that still exists and any additional affected flows. An empty list needs an
|
|
219
|
+
explanation of why existing claims are unaffected; it does not mean the changed
|
|
220
|
+
code is tested.
|
|
221
|
+
|
|
222
|
+
Save the assessments and graph edits, validate, and copy the examined change
|
|
223
|
+
tokens. Save again, then validate once more before copying final flow tokens.
|
|
224
|
+
Assessing a change can make another flow stale, so the order matters. Removing
|
|
225
|
+
an assessment or reverting a file does not by itself clear an unresolved change.
|
|
226
|
+
|
|
227
|
+
Keep removed or ambiguous assertion records for review under `retiredAssertions`.
|
|
228
|
+
Follow the supplied questions when inheriting older maps. Do not invent source
|
|
229
|
+
links or evidence to clear a warning.
|
|
230
|
+
|
|
231
|
+
## Keep queries fast
|
|
232
|
+
|
|
233
|
+
Reports reuse a disposable assessment cache while checking that sources still
|
|
234
|
+
match. Editing the map invalidates the cached assessment automatically. Queries
|
|
235
|
+
never acknowledge flows or change the authored map. See [Speed and storage](performance.md)
|
|
236
|
+
for keeping repeated investigation fast.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Understanding assertion coverage
|
|
2
|
+
|
|
3
|
+
Assertion coverage helps you see which parts of your JavaScript or TypeScript
|
|
4
|
+
code are checked by tests. After a normal run, your coding agent records what
|
|
5
|
+
each assertion checks in `assertions.json`. Supercov combines that map with the
|
|
6
|
+
run's execution evidence and shows an **Assertions** percentage alongside Lines,
|
|
7
|
+
Branches and MC/DC.
|
|
8
|
+
|
|
9
|
+
## Start with your existing tests
|
|
10
|
+
|
|
11
|
+
```sh supercov
|
|
12
|
+
npx supercov -- npm test
|
|
13
|
+
npx supercov runs latest assertions
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Use your project's test command after `--`. Each run creates its own map and
|
|
17
|
+
reuses compatible work from earlier runs of the same command. The assertions
|
|
18
|
+
list shows the map's path and the assertions that still need attention.
|
|
19
|
+
|
|
20
|
+
Copy the printed run ID before asking an agent to edit the map. This keeps its
|
|
21
|
+
work on the same run even if another test run finishes. You can give it this
|
|
22
|
+
prompt, replacing `<run-id>` with that ID:
|
|
23
|
+
|
|
24
|
+
```text
|
|
25
|
+
Read the instructions from npx supercov docs assertion-agent. Build or update
|
|
26
|
+
assertion coverage for run <run-id>. Investigate the tests and current source,
|
|
27
|
+
then edit that run's assertions.json. Preserve reusable flows and explain
|
|
28
|
+
uncertainty. Do not change application code or tests. Validate the map and
|
|
29
|
+
show the assertion percentage, remaining gaps, and any missing evidence.
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
You can use your usual coding agent. Supercov does not require a particular
|
|
33
|
+
model or make model calls itself.
|
|
34
|
+
|
|
35
|
+
## Read the percentage
|
|
36
|
+
|
|
37
|
+
```sh supercov-example
|
|
38
|
+
npx supercov runs <run-id>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
An illustrative report might show:
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
Assertions 62.50% (50/80) — agent-assessed statements, whole run
|
|
45
|
+
18 assertions with flows; 7 without; 29 current flows; 3 stale; 2 draft
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Here, 50 of the run's 80 measured statements have a current explanation linking
|
|
49
|
+
them to a passing assertion, with execution recorded in the same test. Each
|
|
50
|
+
statement counts once, even when several assertions check it. Unexecuted code
|
|
51
|
+
stays in the denominator. TypeScript imports that are known to disappear during
|
|
52
|
+
compilation are excluded.
|
|
53
|
+
|
|
54
|
+
The score describes the whole run. Filtering Lines or MC/DC by test kind does
|
|
55
|
+
not change the assertion percentage. You do not need to rerun tests just to
|
|
56
|
+
recalculate a map: save it and query the run again.
|
|
57
|
+
|
|
58
|
+
| Report state | What to do |
|
|
59
|
+
| --- | --- |
|
|
60
|
+
| Not assessed | Ask your agent to start explaining the assertions. |
|
|
61
|
+
| Pending | Inspect changed inputs, draft flows or stale flows before using a percentage. |
|
|
62
|
+
| Unavailable | Check for a failed run, invalid map or source that no longer matches the run. |
|
|
63
|
+
| Not applicable | The run has no measured statements. |
|
|
64
|
+
|
|
65
|
+
A partially written map can have a useful percentage. Check the counts beside
|
|
66
|
+
it: having some flows does not mean every relevant flow has been found.
|
|
67
|
+
|
|
68
|
+
## Check what an assertion actually protects
|
|
69
|
+
|
|
70
|
+
Suppose `src/shipping.js` contains:
|
|
71
|
+
|
|
72
|
+
```js
|
|
73
|
+
export function shippingCost() {
|
|
74
|
+
return 4;
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
These tests all call the function, but they check different things. Here,
|
|
79
|
+
`assert` comes from `node:assert/strict`:
|
|
80
|
+
|
|
81
|
+
| Assertion | What it checks |
|
|
82
|
+
| --- | --- |
|
|
83
|
+
| `assert.equal(shippingCost(), 4)` | The cost is exactly `4`. Returning `5` would fail. |
|
|
84
|
+
| `assert.ok(shippingCost())` | The cost is truthy. Returning `5` would still pass. |
|
|
85
|
+
| `shippingCost(); assert.equal(7, 7)` | Nothing about the returned cost. The assertion compares constants. |
|
|
86
|
+
|
|
87
|
+
Line coverage can be the same in all three cases. Even a credited statement can
|
|
88
|
+
change without failing a test when the new value still satisfies the assertion.
|
|
89
|
+
Read the mapped observation when deciding whether a test protects your change.
|
|
90
|
+
|
|
91
|
+
## Inspect a gap
|
|
92
|
+
|
|
93
|
+
```sh supercov-example
|
|
94
|
+
npx supercov runs <run-id> assertions --needs-attention --limit 5
|
|
95
|
+
npx supercov runs <run-id> assertion <assertion-id>
|
|
96
|
+
npx supercov runs <run-id> assertions report --view statements --file src/shipping.js
|
|
97
|
+
npx supercov runs <run-id> source src/shipping.js
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
An assertion detail shows its exact location in the test, its recorded flows,
|
|
101
|
+
and why each source node is credited, not credited or context only. Use this to
|
|
102
|
+
find a missing scenario, strengthen a weak check or correct an explanation.
|
|
103
|
+
See [Investigating assertion evidence](assertion-evidence.md) when execution
|
|
104
|
+
or a passing assertion is missing.
|
|
105
|
+
|
|
106
|
+
An absence check, such as “no message was received,” can be useful without
|
|
107
|
+
crediting a message-sending statement that never ran. Its map should explain
|
|
108
|
+
what was observed, when observation ended and why that was sufficient.
|
|
109
|
+
|
|
110
|
+
## Keep the map when code changes
|
|
111
|
+
|
|
112
|
+
Run the same suite command again after editing source or tests. Supercov copies
|
|
113
|
+
reusable mappings into the new run and identifies flows that need another look.
|
|
114
|
+
One changed dependency can affect a single flow; changing the assertion itself
|
|
115
|
+
can affect all its flows. Your agent can update those parts instead of starting
|
|
116
|
+
over.
|
|
117
|
+
|
|
118
|
+
Investigation uses your current project files. A run retains the map and file
|
|
119
|
+
identities, but does not keep a complete source checkout. If the source no
|
|
120
|
+
longer matches, rerun tests before continuing the map.
|
|
121
|
+
|
|
122
|
+
## Use the score to guide changes
|
|
123
|
+
|
|
124
|
+
Use MC/DC to find missing condition cases and assertion coverage to investigate
|
|
125
|
+
what those tests check. Improve the weakest observations and the gaps relevant
|
|
126
|
+
to your change, then run the full suite again.
|
|
127
|
+
|
|
128
|
+
Neither percentage proves that every possible bug will fail a test. A high
|
|
129
|
+
score is most useful together with the recorded observations and a review of
|
|
130
|
+
the behavior you intend to preserve. See [Assertion map format](assertion-maps.md)
|
|
131
|
+
for editing and validation, or [Trusting results](verification.md) for the
|
|
132
|
+
broader test-review workflow.
|
package/docs/cli.md
CHANGED
|
@@ -17,7 +17,9 @@ npx supercov --help
|
|
|
17
17
|
| Read the newest run | `npx supercov runs latest` |
|
|
18
18
|
| Find useful gaps | `npx supercov runs latest gaps` |
|
|
19
19
|
| Inspect one file | `npx supercov runs latest file <path>` |
|
|
20
|
-
|
|
|
20
|
+
| List assertions and their status | `npx supercov runs latest assertions` |
|
|
21
|
+
| Inspect one assertion and its flows | `npx supercov runs latest assertion <id>` |
|
|
22
|
+
| Read matching current source code | `npx supercov runs latest source <path>` |
|
|
21
23
|
| Compare two runs | `npx supercov diff <older> <newer>` |
|
|
22
24
|
| Combine shards | `npx supercov merge <id> <id> [...]` |
|
|
23
25
|
| Remove local data | `npx supercov clean` |
|
|
@@ -72,7 +74,9 @@ npx supercov runs <run-id> [query] [options]
|
|
|
72
74
|
| `kinds` | Group coverage by test level, such as unit or E2E |
|
|
73
75
|
| `runners` | Group coverage by test runner |
|
|
74
76
|
| `scope` | Review included, excluded, and ambiguous source files |
|
|
75
|
-
| `assertions` |
|
|
77
|
+
| `assertions` | List assertions, including sites without flows, with freshness and execution status |
|
|
78
|
+
| `assertion <id>` | Inspect one assertion and its authored flows |
|
|
79
|
+
| `source <path>` | Read matching current project source with line numbers |
|
|
76
80
|
| `minimize` | Find a small test subset that preserves a coverage target |
|
|
77
81
|
|
|
78
82
|
Common examples:
|
|
@@ -93,12 +97,40 @@ npx supercov runs latest file --help
|
|
|
93
97
|
npx supercov runs latest assertions --help
|
|
94
98
|
```
|
|
95
99
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
Assertion queries read the run-owned map. `source <path>` reads the matching current
|
|
101
|
+
file directly. It prints source code with line numbers, preserving indentation;
|
|
102
|
+
add `--json` only when you want structured `{line, text}` items. `--offset` is
|
|
103
|
+
zero-based and `--limit` controls the number of source lines. Source and assertion
|
|
104
|
+
investigation require current files that match the run. Rerun the suite after
|
|
105
|
+
source changes to inherit the map into a new run.
|
|
106
|
+
|
|
107
|
+
### Assertion coverage
|
|
108
|
+
|
|
109
|
+
The regular run summary includes assertion coverage when a map has been
|
|
110
|
+
assessed. JSON reports expose it under `data.assertionCoverage`. Start with
|
|
111
|
+
[Understanding assertion coverage](assertions.md), or use these commands to
|
|
112
|
+
inspect and check a map:
|
|
113
|
+
|
|
114
|
+
```sh supercov-example
|
|
115
|
+
npx supercov runs <run-id> assertions --needs-attention
|
|
116
|
+
npx supercov runs <run-id> assertion <assertion-id>
|
|
117
|
+
npx supercov runs <run-id> assertions report --view statements --file src/shipping.js
|
|
118
|
+
npx supercov runs <run-id> assertions report --view excludedStatements
|
|
119
|
+
npx supercov runs <run-id> assertions validate --json
|
|
120
|
+
npx supercov runs <run-id> assertions check --require-mappings
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Edit the file shown by `assertions`. Validation returns `expectedBasis` tokens;
|
|
124
|
+
after examining a flow, save its token in the map before running `check`.
|
|
125
|
+
`--require-mappings` requires explanations for recognized assertions observed
|
|
126
|
+
passing. Add `--require-observed` when every mapped site and selector should have
|
|
127
|
+
passing evidence, or `--min <percentage>` for a chosen target.
|
|
128
|
+
|
|
129
|
+
To inspect one large flow, add `--flow <flow-id> --view nodes` or `--view edges`
|
|
130
|
+
to the assertion detail command. `--compact` omits repeated source text from the
|
|
131
|
+
report. Follow the printed next-page command or JSON `pagination.nextOffset`.
|
|
132
|
+
Validation supports `--view flows`, `--view changes` and `--view errors` for large
|
|
133
|
+
maps. The [map reference](assertion-maps.md) describes all fields and gates.
|
|
102
134
|
|
|
103
135
|
## Narrow a view
|
|
104
136
|
|
package/docs/coverage-model.md
CHANGED
|
@@ -33,6 +33,7 @@ npx supercov runs latest scope
|
|
|
33
33
|
| Branch | Did each alternative execute? |
|
|
34
34
|
| Decision vector | Which combinations of boolean conditions occurred? |
|
|
35
35
|
| MC/DC witness | Was each condition shown to affect the decision independently? |
|
|
36
|
+
| Assertion coverage | Which measured statements are linked to passing checks by the agent-authored map? |
|
|
36
37
|
| Value path | Did defaults, optional chains, logical assignments, and similar constructs take each meaningful path? |
|
|
37
38
|
|
|
38
39
|
The exact obligations depend on the language and source construct. You do not
|
|
@@ -71,6 +72,14 @@ does not mean the product has no bugs, the assertions are meaningful, or every
|
|
|
71
72
|
possible input was tested. Review test quality and user-visible behavior, not
|
|
72
73
|
only the percentage.
|
|
73
74
|
|
|
75
|
+
TypeScript imports known to disappear during compilation do not add runtime
|
|
76
|
+
statement obligations. The assertion report's `excludedStatements` view lists
|
|
77
|
+
these locations. Imports that still execute, including side-effect imports,
|
|
78
|
+
remain in the denominator.
|
|
79
|
+
|
|
80
|
+
To review what your JavaScript and TypeScript tests actually check, see
|
|
81
|
+
[Understanding assertions](assertions.md).
|
|
82
|
+
|
|
74
83
|
If source cannot be measured safely, Supercov reports a measurement limit
|
|
75
84
|
instead of claiming completeness.
|
|
76
85
|
|
|
@@ -138,3 +147,12 @@ the bundler consumes them at build time; nothing about them runs.
|
|
|
138
147
|
|
|
139
148
|
Choose roots that describe code the repository owns. Do not include dependencies
|
|
140
149
|
or generated output merely to make a warning disappear.
|
|
150
|
+
|
|
151
|
+
## Assertion percentage
|
|
152
|
+
|
|
153
|
+
When a run has an `assertions.json` map, its regular summary also shows
|
|
154
|
+
agent-assessed assertion coverage: credited measured statements divided by all
|
|
155
|
+
measured statements. This row always describes the whole archived run,
|
|
156
|
+
independently of `--filter`, `--kind` and `--runner`. It is separate from the
|
|
157
|
+
structural metrics above. See [assertion maps](assertion-maps.md) for credit,
|
|
158
|
+
freshness and incomplete-map rules.
|
package/docs/evidence.md
CHANGED
|
@@ -109,3 +109,31 @@ npx supercov clean
|
|
|
109
109
|
Preview cleanup first. The final command removes all runs and the isolated build
|
|
110
110
|
cache; `--keep 20` preserves the 20 newest runs. Cleanup removes only
|
|
111
111
|
marker-owned Supercov data.
|
|
112
|
+
|
|
113
|
+
## Understand test kinds
|
|
114
|
+
|
|
115
|
+
Reports group tests by kind, such as unit, integration or E2E. Supercov uses
|
|
116
|
+
recognized file names and runner information; a kind is a classification, not
|
|
117
|
+
proof of what the test checks. A name such as `gatewayE2e.test.ts` identifies an
|
|
118
|
+
E2E test. Ambiguous names keep the runner's default, and the report tells you
|
|
119
|
+
how many tests use that default.
|
|
120
|
+
|
|
121
|
+
If your suite has a known kind, set it when running the command:
|
|
122
|
+
|
|
123
|
+
```sh supercov-example
|
|
124
|
+
SUPERCOV_TEST_KIND=integration npx supercov -- npm test
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Supported values are `unit`, `component`, `integration` and `e2e`. Use separate
|
|
128
|
+
runs when different suites need different classifications.
|
|
129
|
+
|
|
130
|
+
## When assertion evidence is missing
|
|
131
|
+
|
|
132
|
+
A test can make assertions without executing measured application code. It
|
|
133
|
+
might check static data or a dependency, or use work performed in shared setup.
|
|
134
|
+
Missing attribution across an asynchronous boundary can also leave a gap.
|
|
135
|
+
|
|
136
|
+
The assertion detail explains why a mapped node did or did not receive credit.
|
|
137
|
+
Use [Investigating assertion evidence](assertion-evidence.md) to distinguish
|
|
138
|
+
these cases. The report's runtime action-phase counts are separate from the
|
|
139
|
+
assertion map; zero action-phase lines does not mean zero asserted statements.
|
package/docs/performance.md
CHANGED
|
@@ -82,3 +82,19 @@ npx supercov clean
|
|
|
82
82
|
Use `--dry-run` to preview cleanup. Keep enough run history for active reviews
|
|
83
83
|
and automation; remove the cache only when reclaiming space matters more than a
|
|
84
84
|
faster next run.
|
|
85
|
+
|
|
86
|
+
## Keep assertion investigation fast
|
|
87
|
+
|
|
88
|
+
Save `assertions.json` and query the run to see the updated score. Supercov does
|
|
89
|
+
not rerun tests or call a model to calculate the report. Repeated queries reuse
|
|
90
|
+
the previous assessment while checking that your source still matches the run.
|
|
91
|
+
Editing the map automatically refreshes that assessment.
|
|
92
|
+
|
|
93
|
+
For large maps, ask for a short page instead of the whole graph. Within one
|
|
94
|
+
flow, `--view nodes` or `--view edges` pages the details; `--compact` omits repeated
|
|
95
|
+
source text while keeping locations and credit reasons. See
|
|
96
|
+
[Investigating assertion evidence](assertion-evidence.md#read-a-large-flow).
|
|
97
|
+
|
|
98
|
+
The disposable `assertions.report.cache.json` file lives beside the map. A missing
|
|
99
|
+
or damaged cache is rebuilt. Removing it affects the next query's speed, not
|
|
100
|
+
your saved explanations.
|