Skip to content

Commit 66a9348

Browse files
committed
docs: simplify readme
1 parent 5c1d83e commit 66a9348

1 file changed

Lines changed: 35 additions & 46 deletions

File tree

README.md

Lines changed: 35 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,20 @@
1-
<p align="center">
2-
<a href="https://callstack.com/open-source/?utm_source=github.com&utm_medium=referral&utm_campaign=ovelapped&utm_term=readme">
3-
<img alt="ovelapped" src="https://callstack.com/images/open-source/callstack-open-source.svg" width="300" />
4-
</a>
5-
</p>
6-
7-
---
8-
91
# ovelapped
102

11-
Find unit tests whose coverage is fully subsumed by integration tests.
12-
133
Find the unit tests your AI agent wrote twice.
144

155
## Overview
166

17-
`ovelapped` analyzes your test suite to find unit tests that don't cover anything your integration tests don't already cover. It runs each unit test in isolation, compares its coverage fingerprint against a reference suite (e.g. integration or e2e tests), and reports which tests are redundant.
7+
`ovelapped` finds unit tests that add no coverage beyond a reference suite, such as integration, e2e, or provider tests.
188

19-
Supports **vitest** and **jest** out of the box — the runner is auto-detected from your project dependencies.
9+
It runs each candidate unit test in isolation, compares its statement and branch coverage against the reference coverage, and reports tests that cover nothing new.
2010

21-
Use it when a test suite has grown in bulk, especially after AI-assisted test generation, and you want to keep only the tests that add coverage signal.
11+
Use it when a test suite has grown in bulk, especially after AI-assisted test generation, and you want to keep the tests that still carry signal.
12+
13+
Supports **vitest** and **jest** out of the box. The runner is auto-detected from your project dependencies.
2214

2315
## Real-World Cleanup
2416

25-
In [callstackincubator/agent-device#595](https://github.com/callstackincubator/agent-device/pull/595), `ovelapped` was used to audit a large AI-assisted test suite against provider-integration coverage.
17+
In [callstackincubator/agent-device#595](https://github.com/callstackincubator/agent-device/pull/595), `ovelapped` audited a large AI-assisted unit suite against provider-integration coverage.
2618

2719
| Metric | Before | After |
2820
|---|---:|---:|
@@ -35,31 +27,36 @@ In [callstackincubator/agent-device#595](https://github.com/callstackincubator/a
3527
| Branch coverage | 71.94% | 71.96% |
3628
| Line coverage | 84.49% | 84.5% |
3729

38-
The important bit: all removed tests covered only statements and branches already covered by integration tests. The suite got smaller without losing coverage.
30+
Every removed test covered only statements and branches that the integration suite already covered. Smaller suite, same coverage signal.
3931

4032
## Quick Start
4133

42-
Compare default unit tests against a reference suite:
34+
Compare a unit suite against the suite that already gives you confidence:
4335

4436
```bash
45-
npx ovelapped analyze
37+
npx ovelapped analyze \
38+
--reference integration \
39+
--unit unit \
40+
--include "src/**/*.test.ts"
4641
```
4742

48-
This will:
43+
Review `ovelapped-report.json`, then preview removals:
4944

50-
1. Run your reference test suite with coverage
51-
2. Discover and run each unit test in isolation
52-
3. Compare coverage fingerprints at statement and branch level
53-
4. Write a JSON report to `ovelapped-report.json`
45+
```bash
46+
npx ovelapped prune --dry-run
47+
```
5448

55-
To remove the redundant tests:
49+
Apply the cleanup when the preview looks right:
5650

5751
```bash
58-
npx ovelapped prune --dry-run # preview changes
59-
npx ovelapped prune # apply changes
52+
npx ovelapped prune
6053
```
6154

62-
For a Vitest workspace with named projects, like the agent-device cleanup:
55+
Then run your full test suite with coverage and confirm thresholds still pass.
56+
57+
## Common Setups
58+
59+
Vitest workspace with named projects, like the agent-device cleanup:
6360

6461
```bash
6562
npx ovelapped analyze \
@@ -69,13 +66,12 @@ npx ovelapped analyze \
6966
--include "src/**/*.test.ts"
7067
```
7168

72-
Recommended cleanup loop:
69+
Existing reference coverage:
7370

74-
1. Run `ovelapped analyze`.
75-
2. Review `ovelapped-report.json`.
76-
3. Run `ovelapped prune --dry-run`.
77-
4. Apply with `ovelapped prune`.
78-
5. Run your full test suite with coverage and confirm thresholds still pass.
71+
```bash
72+
npx ovelapped analyze \
73+
--reference-coverage ./coverage/coverage-final.json
74+
```
7975

8076
## Prerequisites
8177

@@ -87,19 +83,11 @@ Recommended cleanup loop:
8783

8884
### `ovelapped analyze`
8985

90-
Runs the full analysis. By default it executes your reference suite to generate coverage, then runs each discovered unit test individually.
91-
92-
Use `--reference` for the integration, e2e, or provider suite that should act as the coverage baseline. Use `--unit` for the suite containing candidate tests to remove.
93-
94-
If you already have a `coverage-final.json` from a prior run, skip the reference suite:
95-
96-
```bash
97-
ovelapped analyze --reference-coverage ./coverage/coverage-final.json
98-
```
86+
Builds the redundancy report. Use `--reference` for the suite that acts as the coverage baseline, and `--unit` for the suite containing candidate tests to remove.
9987

10088
### `ovelapped prune`
10189

102-
Reads the analysis report and removes subsumed tests from source files. Files where all tests are subsumed are deleted entirely; files with a mix get individual test blocks removed.
90+
Reads the report and removes redundant tests. Files where every test is redundant are deleted entirely; mixed files get individual test blocks removed.
10391

10492
Always review changes with `--dry-run` first.
10593

@@ -118,10 +106,11 @@ Always review changes with `--dry-run` first.
118106

119107
## How It Works
120108

121-
1. **Reference fingerprint** — Runs (or loads) coverage for the reference suite. Each covered statement and branch becomes a key in a `Set<string>` (e.g. `"/src/foo.ts:s:3"`, `"/src/foo.ts:b:1:0"`).
122-
2. **Per-test fingerprint** — Runs each unit test in isolation with coverage, building the same fingerprint.
123-
3. **Subsumption check** — If every key in a test's fingerprint exists in the reference fingerprint, the test is *subsumed* — it exercises no code path that the reference suite doesn't already cover.
124-
4. **Pruning** — Removes subsumed test blocks from source files using bracket-matching (no AST required).
109+
1. Runs or loads Istanbul `coverage-final.json` for the reference suite.
110+
2. Runs each candidate unit test in isolation with coverage.
111+
3. Turns covered statements and branches into fingerprint keys, such as `"/src/foo.ts:s:3"` and `"/src/foo.ts:b:1:0"`.
112+
4. Marks a test redundant only when every key in its fingerprint already exists in the reference fingerprint.
113+
5. Removes redundant test blocks with bracket matching. No AST, no runtime dependencies, no guesswork.
125114

126115
## License
127116

0 commit comments

Comments
 (0)