Skip to content

Commit 7c1ef64

Browse files
committed
update readme
1 parent 82eebca commit 7c1ef64

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

README.md

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,19 @@
1212

1313
A tool for defining and enforcing test coverage thresholds locally as well as in CI pipelines - similar to the coverage thresholds in JavaScripts popular Testing Framework [Jest](https://jestjs.io/docs/configuration#coveragethreshold-object).
1414

15-
`limgo` builds on top of the code coverage file generated by `go test` and extends it by a configuration file to define thresholds on directories and files using regular expressions. If those thresholds are not met, `limgo` will exit with code 1.
16-
17-
Currently, a coverage percentage as threshold can be defined for
18-
- Statements
19-
- Lines of Code
20-
- Branches
15+
`limgo` builds on top of the code coverage file generated by `go test` and extends it by a configuration file to define thresholds on directories and files using regular expressions. If those thresholds are not met, `limgo` will exit with code 1 and displays the coverage statistic for the module as well as a message which files do not meet any thresholds.
16+
```
17+
Files % Stmt % Line % Branch Uncovered Lines
18+
github.com/GoTestTools/limgo 29.18 24.59 33.33
19+
pkg/model/coverage 69.77 70.91 60.00
20+
groupedCoverage.go 0.00 0.00 0.00 [10 11 12 13 15 16 17 18 19 20]
21+
line.go 82.76 85.29 100.00 [55 63 71 79 87]
22+
lineMatcher.go 85.71 90.91 50.00 [26]
23+
...
24+
25+
Expected coverage thresholds not met:
26+
'pkg/model/coverage/line.go': expected coverage threshold for statements of 100.00%, but only got 82.76%
27+
```
2128

2229
## Installation
2330

@@ -59,7 +66,7 @@ The following snippet shows a basic example usage of `limgo`:
5966
go test ./... -coverprofile=cov.out
6067

6168
# verify that the coverage is not below the thresholds defined in .limgo.json
62-
limgo -coverfile=cov.out -config=.limgo.json -v=1
69+
limgo -coverfile=cov.out -config=.limgo.json -v=3
6370
```
6471

6572
An overview as well as a short description of all supported flags can be displayed via
@@ -71,7 +78,7 @@ limgo -help
7178

7279
Coverage thresholds are defined in a configuration file. By default, `limgo` will search for a file named `.limgo.json`. This can be overridden by the `-config` flag.
7380

74-
Currently, coverage thresholds for `statements` and `functions` are supported. In the configuration file example below, thresholds are defined
81+
Currently, coverage thresholds for `statements`, `lines` and `branches` are supported. In the configuration file example below, thresholds are defined
7582
- on a global (project) level
7683
- for all files in the "coverage" directory
7784
- for all files in the "gosrc" directory starting with g
@@ -80,16 +87,19 @@ Currently, coverage thresholds for `statements` and `functions` are supported. I
8087
"coverageThreshold": {
8188
"global": {
8289
"statements": 50,
83-
"functions": 50
90+
"lines": 55,
91+
"branches": 33
8492
},
8593
"matcher": {
8694
"pkg/coverage": {
8795
"statements": 70,
88-
"functions": 80
96+
"lines": 70,
97+
"branches": 33
8998
},
9099
"pkg/gosrc/g.*": {
91100
"statements": 10,
92-
"functions": 20
101+
"lines": 15,
102+
"branches": 50,
93103
}
94104
},
95105
"excludes": [
@@ -132,7 +142,7 @@ jobs:
132142
- name: Set up limgo - option 2
133143
uses: GoTestTools/[email protected]
134144
with:
135-
version: "v0.0.0-beta"
145+
version: "v0.0.1-beta"
136146
install-only: true
137147

138148
# Run tests with coverprofile

0 commit comments

Comments
 (0)