File tree Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "no-coverage.js" : {
3
+ "path" : " no-coverage.js" ,
4
+ "s" : {}
5
+ }
6
+ }
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ By default `only-covered` script reads `.nyc_output/out.json` file from the curr
17
17
18
18
``` shell
19
19
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
20
21
```
21
22
22
23
[ ci image ] : https://github.com/bahmutov/check-code-coverage/workflows/ci/badge.svg?branch=master
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env node
2
2
// @ts -check
3
- const { join } = require ( 'path' )
3
+ const { join, resolve } = require ( 'path' )
4
+ const arg = require ( 'arg' )
4
5
5
- const filename = process . argv [ 2 ]
6
+ const args = arg ( {
7
+ '--from' : String , // input filename, by default ".nyc_output/out.json"
8
+ } )
9
+
10
+ const filename = args . _ [ 0 ]
6
11
if ( ! filename ) {
7
12
console . error ( 'Usage: node %s <file name>' , __filename )
8
13
process . exit ( 1 )
9
14
}
10
- const coverageFilename = join ( process . cwd ( ) , '.nyc_output' , 'out.json' )
15
+
16
+ const fromFilename = args [ '--from' ] || join ( '.nyc_output' , 'out.json' )
17
+ const coverageFilename = resolve ( fromFilename )
18
+
11
19
const coverage = require ( coverageFilename )
12
20
const fileCoverageKey = Object . keys ( coverage ) . find ( name => {
13
21
const fileCover = coverage [ name ]
You can’t perform that action at this time.
0 commit comments