uncoverage
v0.1.0
Published
Extract uncovered lines from Istanbul coverage reports — with context — ready to paste into ChatGPT, Claude, or Gemini for debugging or test generation.
Downloads
3
Readme
uncoverage
⚡ Easily extract uncovered code context from Istanbul coverage reports — perfect for debugging with AI assistants like ChatGPT, Claude, or Gemini.
✨ What is this?
uncoverage is a simple CLI tool that helps you extract surrounding lines of uncovered code from Istanbul-style coverage reports (coverage-final.json).
You can quickly copy/paste context into your favorite LLM (Large Language Model) such as:
- 🧠 ChatGPT
- 🧠 Claude
- 🧠 Gemini
This is useful when you're trying to understand why something isn't covered or want help generating missing test cases.
📦 Currently supported
- ✅ Istanbul coverage format (e.g. generated by Jest, nyc, vitest)
🚀 Usage
You can run it directly with npx:
npx uncoverage coverage/coverage-final.jsonor install globally:
npm install -g uncoverage
uncoverage coverage/coverage-final.json🛠 What it does
- Parses
coverage-final.json - Finds all uncovered statements
- Groups adjacent uncovered lines (with context lines before/after)
- the grouped code context with line numbers and
← uncoveredmarkers will be copied to your clipboard
⚙️ CLI Options
| Flag | Type | Default | Description |
| ---------- | ------- | ------- | ----------------------------------------------------- |
| --before | Number | 1 | Number of lines before uncovered lines to include |
| --after | Number | 1 | Number of lines after uncovered lines to include |
| --output | String | – | Write the output to a file (Markdown format) |
| --print | Boolean | false | Print to stdout instead of copying to clipboard |
🧪 Example
npx uncoverage coverage/coverage-final.json --before 2 --after 3 --printThis will print Markdown-formatted uncovered code with 2 lines before and 3 lines after each uncovered block.
💡 Example output
## ❗ Here are the files and code blocks that are not covered by tests
### `src/utils/math.ts`
#### 🧩 Lines 42 - 45
```ts
40: const a = 1;
41: const b = 2;
42: if (!user.email) return; // ← uncovered
43: await sendWelcomeEmail(user); // ← uncovered
44: user.notified = true; // ← uncovered
45: return user; // ← uncovered
46: log(user);
47: return;🧠 Why?
Sometimes you don’t want a full HTML coverage report — just the exact code that isn’t covered, in a form you can easily show to ChatGPT or Claude to ask:
“Can you help me write tests for this?”
That’s what uncoverage is for. 🚀
🧙♂️ Author
Made with 💛 by @mildronize
🧾 License
MIT
