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
1717
1818``` shell
1919only-covered --from examples/exclude-files/coverage/coverage-final.json main.js
20+ check-coverage --from examples/exclude-files/coverage/coverage-final.json main.js
2021```
2122
2223[ 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 11#!/usr/bin/env node
22// @ts -check
3- const { join } = require ( 'path' )
3+ const { join, resolve } = require ( 'path' )
4+ const arg = require ( 'arg' )
45
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 ]
611if ( ! filename ) {
712 console . error ( 'Usage: node %s <file name>' , __filename )
813 process . exit ( 1 )
914}
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+
1119const coverage = require ( coverageFilename )
1220const fileCoverageKey = Object . keys ( coverage ) . find ( name => {
1321 const fileCover = coverage [ name ]
You can’t perform that action at this time.
0 commit comments