Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/silverbucket/threshold
A simple Deno tool which parses the output of `deno coverage` for a minimum coverage threshold
https://github.com/silverbucket/threshold
Last synced: 1 day ago
JSON representation
A simple Deno tool which parses the output of `deno coverage` for a minimum coverage threshold
- Host: GitHub
- URL: https://github.com/silverbucket/threshold
- Owner: silverbucket
- License: mit
- Created: 2024-08-28T09:49:51.000Z (3 months ago)
- Default Branch: master
- Last Pushed: 2024-08-28T11:50:12.000Z (3 months ago)
- Last Synced: 2024-10-12T17:30:41.081Z (about 1 month ago)
- Language: TypeScript
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @silverbucket/threshold
A simple Deno tool which parses the output of `deno coverage` to check for a minimum coverage threshold
# About
This is intended as a dead-simple check for a basic minimum threshold of test code coverage. It's a stop-gap until deno
implements some for of defining thresholds natively during a `deno coverage` run.It parses the output of `deno coverage`, and only checks the `All files` line, for `branch` and `line` coverage,
ensuring they meet a minimum threshold.# Usage
## CLI
First, you should run tests and generate a coverage report. Then you can run the `deno coverage` command and pipe the
output to this script, with optional values for `branch` and `threshold` (defaults to 85 for both).```bash
deno test --coverage
deno coverage | deno run jsr:@silverbucket/threshold 90 92
```In this case the threshold for `branch` is `90%` and the threshold for `line` is `91%`
## Module
You can optionally import the `Threshold` class in your program.
```ts
import Threshold from "jsr:@silverbucket/threshold";const thres = new Threshold(90, 92);
// get deno converage output
const errors = thres.processInput(deno_coverage);
if (errors.length) {
// report errors
}
```# Author
Nick Jennings
# License
MIT