File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -3,14 +3,21 @@ let program = require('commander');
33
44program
55 . arguments ( '<jsonFile>' )
6+ . option ( '-t, --total' , 'Only print the total time' )
67 . action ( function ( jsonFile ) {
78 let lineReader = require ( 'readline' ) . createInterface ( {
89 input : require ( 'fs' ) . createReadStream ( jsonFile )
910 } ) ;
10- console . log ( "class file; function name; execution time (ms);"
11- + "success; goals covered; total number of goals" ) ;
11+ const printTotalTime = typeof program . total != 'undefined' ;
12+ let totalTime = 0.0 ;
13+ if ( ! printTotalTime )
14+ console . log ( "class file; function name; execution time (ms);"
15+ + "success; goals covered; total number of goals" ) ;
1216 lineReader . on ( 'line' , function ( data ) {
1317 let json = JSON . parse ( data . toString ( ) ) ;
18+ totalTime += parseFloat ( json . execTime ) ;
19+ if ( printTotalTime )
20+ return ;
1421 console . log (
1522 json . classFile + ";" +
1623 json [ 'function' ] . replace ( / ; / g, "_" ) + "; " +
@@ -19,5 +26,10 @@ program
1926 ( ( typeof json . goals != 'undefined' ) ? json . goals . goalsCovered : "0" ) + ";" +
2027 ( ( typeof json . goals != 'undefined' ) ? json . goals . totalGoals : "" ) ) ;
2128 } ) ;
29+ if ( printTotalTime ) {
30+ lineReader . on ( 'close' , function ( ) {
31+ console . log ( jsonFile + "; " + totalTime )
32+ } ) ;
33+ }
2234 } )
2335 . parse ( process . argv ) ;
You can’t perform that action at this time.
0 commit comments