Programowanie · Testowanie
bun-test-coverage
/bun-test-coverage
Mierzy pokrycie testami w Bun przez flagę --coverage: raporty lcov, progi i integracja z CI.
Dla kogo
- Autor
- secondsky ↗
- Repozytorium
- claude-skills ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 26.09.2026
Ocena i bezpieczeństwo
100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Przestarzałość
Brak sygnałów. Repozytorium zmienione 26.09.2026, bez odwołań do wycofanych modeli i API.
Licencja
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Mierzy pokrycie testami w Bun przez flagę --coverage: raporty lcov, progi i integracja z CI.
Oryginalny opis (EN)
Use for test coverage with Bun, --coverage flag, lcov reports, thresholds, and CI integration.
Jak działa
- Enabling Coverage
- Configuration in bunfig.toml
- Coverage Output
- Coverage Reporters
- Coverage Thresholds
- Excluding Files
- CI Integration
- Programmatic Coverage
- Common Errors
- Best Practices
Sekcje z nagłówków SKILL.md, w oryginale · 156 linii, 423 słów
Podgląd SKILL.md
---
name: bun-test-coverage
description: Use for test coverage with Bun, --coverage flag, lcov reports, thresholds, and CI integration.
metadata:
version: "1.0.0"
license: MIT
---
# Bun Test Coverage
Bun has built-in code coverage reporting without additional dependencies.
## Enabling Coverage
```bash
# Enable coverage
bun test --coverage
# With threshold (fail if below)
bun test --coverage --coverage-threshold 80
```
## Configuration in bunfig.toml
```toml
[test]
coverage = true
coverageThreshold = 0.8 # 80% minimum
coverageDir = "./coverage"
# Patterns to ignore
coverageSkipTestFiles = true
```
## Coverage Output
```
------------------|---------|---------|-------------------
File | % Funcs | % Lines | Uncovered Line #s
------------------|---------|---------|-------------------
All files | 85.71 | 89.23 |
src/index.ts | 100.00 | 100.00 |
src/utils.ts | 75.00 | 82.35 | 23-25, 41-43
src/api.ts | 80.00 | 85.00 | 67, 89-92
------------------|---------|---------|-------------------
```
## Coverage Reporters
```bash
# Default console output
bun test --coverage
# Generate lcov report
bun test --coverage --coverage-reporter=lcov
# Multiple reporters
bun test --coverage --coverage-reporter=text --coverage-reporter=lcov
```
### Available Reporters
| Reporter | Output |
|----------|--------|
| `text` | Console table (default) |
| `lcov` | `coverage/lcov.info` for CI tools |
| `json` | `coverage/coverage.json` |
## Coverage Thresholds
Set minimum coverage requirements:
```bash
# Fail if coverage < 80%
bun test --coverage --coverage-threshold 80
# Per-metric thresholds in bunfig.toml
```
```toml
[test]
coverage = true
coverageThreshold = {
lines = 80,
functions = 75,
branches = 70
}
```
## Excluding Files
```toml
[test]
coverage = true
# Skip test files from coverage
coverageSkipTestFiles = true
# Patterns to exclude
coverageIgnore = [
"**/*.test.ts",
"**/fixtures/**",
"**/mocks/**"
]
```
## CI Integration
### GitHub Actions
```yaml
- name: Run tests with coverage
run: bun test --coverage --coverage-reporter=lcov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: ./coverage/lcov.info
```
### Output Directory
```bash
# Custom output directory
bun test --coverage --coverage-dir=./reports/coverage
```
## Programmatic Coverage
```typescript
import { test, expect } from "bun:test";
// Get coverage data programmatically
const coverage = Bun.coverage;
// Access after tests complete
process.on("exit", () => {
console.log(coverage.getCoverageData());
});
```
## Common Errors
| Error | Cause | Fix |
|-------|-------|-----|
| `Coverage threshold not met` | Coverage below threshold | Increase test coverage |
| `No coverage data` | Files not executed | Check test includes file |
| `lcov not found` | Missing reporter | Add `--coverage-reporter=lcov` |
## Best Practices
1. **Set realistic thresholds** - Start at 60%, increase gradually
2. **Exclude generated files** - Mock files, type definitions
3. **Focus on critical paths** - Business logic over boilerplate
4. **Run in CI** - Prevent coverage regression
## When to Load References
Load `references/reporters.md` when:
- Custom reporter configuration
- CI/CD integration details
- Codecov/Coveralls setup
Wersje
W bazie nie ma innych skilli o nazwie bun-test-coverage.
Migawka bazy z 13.11.2026 · wersja paczki 038516f4bb9f (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100dart-collect-coverage
Mierzy pokrycie kodu testami w Dart, generuje raporty LCOV lub HTML i filtruje pliki pokrycia. - 92dart-collect-coverage
Zbiera pokrycie testami pakietem coverage i generuje raport LCOV dla projektów Dart. - 100configure-coverage
Konfiguruje pokrycie kodu testami: progi i raportery dla Vitest, Jest, pytest i Rust, w tym Codecov, Coveralls oraz raporty lcov i HTML. - 96testing-bun
Podpowiada, jak pisać i zmieniać testy w projekcie Bun. - 100qe-coverage-analysis
Analizuje dane pokrycia testami (Istanbul, c8, lcov), wskazuje niepokryte linie, gałęzie i funkcje z wagą ryzyka oraz porównuje pokrycie między gałęziami. - 100bun-test-basics
Opisuje podstawy bun:test: składnię, asercje, describe i it, test.skip, test.only, test.each oraz podstawowe wzorce.