@@ -8,23 +8,21 @@ function reporter(runner) {
88 pass : true ,
99 } ;
1010
11- runner . on ( 'pass' , function ( test : Mocha . ITest ) {
12- let title = test . fullTitle ( ) ;
13- let obj = getIndexAndTitle ( title ) ;
11+ runner . on ( 'pass' , ( test : Mocha . ITest ) => {
12+ const { index} = getIndexAndTitle ( test . fullTitle ( ) ) ;
1413 // add pass
1514 result . passes . push ( {
16- msg : `Task ${ obj . index } Complete` ,
17- taskPosition : obj . index ,
15+ msg : `Task ${ index } Complete` ,
16+ taskPosition : index ,
1817 } ) ;
1918 } ) ;
2019
21- runner . on ( 'fail' , function ( test : Mocha . ITest , err : Error ) {
22- let title = test . fullTitle ( ) ;
23- let obj = getIndexAndTitle ( title ) ;
20+ runner . on ( 'fail' , ( test : Mocha . ITest , err : Error ) => {
21+ const { msg, index} = getIndexAndTitle ( test . fullTitle ( ) ) ;
2422 // add fail
2523 result . failures . push ( {
26- msg : obj . msg ,
27- taskPosition : obj . index - 1 ,
24+ msg,
25+ taskPosition : index - 1 ,
2826 // body: test.body,
2927 timedOut : test . timedOut ,
3028 // duration: test.duration
@@ -44,7 +42,7 @@ function reporter(runner) {
4442
4543 function getIndexAndTitle ( title : string ) : IndexTitle {
4644 // tests prefixed with task number: "01 title"
47- let indexString = title . match ( / ^ [ 0 - 9 ] + / ) ;
45+ const indexString = title . match ( / ^ [ 0 - 9 ] + / ) ;
4846 if ( ! indexString ) {
4947 throw 'Tests should begin with a number, indicating the task number' ;
5048 }
0 commit comments