@@ -5,6 +5,7 @@ export const rootSuite = new Mocha.Suite('') as MochaTypes.Suite;
55rootSuite . timeout ( 10 * 1000 ) ;
66
77let mochaContext = rootSuite ;
8+
89let only = false ;
910
1011export const clearTests = ( ) => {
@@ -14,20 +15,18 @@ export const clearTests = () => {
1415 only = false ;
1516} ;
1617
17- export const it = (
18- name : string ,
19- f : MochaTypes . Func | MochaTypes . AsyncFunc ,
20- ) : void => {
18+ export const it = ( name : string , f : MochaTypes . Func | MochaTypes . AsyncFunc ) : void => {
2119 if ( ! only ) {
22- const test = new Mocha . Test ( name , f ) ;
20+ const test = new Mocha . Test ( name , async ( ) => {
21+ console . log ( `Running ${ name } ` ) ;
22+ // @ts -ignore
23+ return f ( ) ;
24+ } ) ;
2325 mochaContext . addTest ( test ) ;
2426 }
2527} ;
2628
27- export const itOnly = (
28- name : string ,
29- f : MochaTypes . Func | MochaTypes . AsyncFunc ,
30- ) : void => {
29+ export const itOnly = ( name : string , f : MochaTypes . Func | MochaTypes . AsyncFunc ) : void => {
3130 clearTests ( ) ;
3231 const test = new Mocha . Test ( name , f ) ;
3332 mochaContext . addTest ( test ) ;
@@ -36,11 +35,9 @@ export const itOnly = (
3635
3736export const describe = ( name : string , f : ( ) => void ) : void => {
3837 const prevMochaContext = mochaContext ;
39- mochaContext = new Mocha . Suite (
40- name ,
41- prevMochaContext . ctx ,
42- ) as MochaTypes . Suite ;
38+ mochaContext = new Mocha . Suite ( name , prevMochaContext . ctx ) as MochaTypes . Suite ;
4339 prevMochaContext . addSuite ( mochaContext ) ;
40+ console . log ( `Running ${ name } ` ) ;
4441 f ( ) ;
4542 mochaContext = prevMochaContext ;
4643} ;
0 commit comments