Skip to content

Commit c87ed98

Browse files
committed
update readme
1 parent dd2ec84 commit c87ed98

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

README.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,36 @@
55

66
```shell
77
npm i -D check-code-coverage
8-
# check if .nyc_output/out.json has 100% code coverage for main.js
9-
npx check-coverage main.js
108
# check if .nyc_output/out.json has files foo.js and bar.js covered and nothing else
119
npx only-covered foo.js bar.js
1210
```
1311

12+
## check-coverage
13+
14+
Checks if the file is present in the output JSON file and has 100% statement coverage
15+
16+
```shell
17+
# check if .nyc_output/out.json has 100% code coverage for main.js
18+
npx check-coverage main.js
19+
# read coverage report from particular JSON file
20+
check-coverage --from examples/exclude-files/coverage/coverage-final.json main.js
21+
```
22+
23+
The file has to end with "main.js". You can specify part of the path, like this
24+
25+
```shell
26+
npx check-coverage src/app/main.js
27+
```
28+
1429
## only-covered
1530

16-
By default `only-covered` script reads `.nyc_output/out.json` file from the current working directory. You can specify a different file using `--from` parameter
31+
Check if the coverage JSON file only the given list of files and nothing else. By default `only-covered` script reads `.nyc_output/out.json` file from the current working directory. You can specify a different file using `--from` parameter.
1732

1833
```shell
34+
# check if coverage has info about two files and nothing else
35+
only-covered src/lib/utils.ts src/main.js
36+
# read coverage from another file and check if it only has info on "main.js"
1937
only-covered --from examples/exclude-files/coverage/coverage-final.json main.js
20-
check-coverage --from examples/exclude-files/coverage/coverage-final.json main.js
2138
```
2239

2340
## check-total

0 commit comments

Comments
 (0)