File tree 2 files changed +13
-1
lines changed
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -939,7 +939,9 @@ Runner.prototype.run = function(fn) {
939
939
this . emit ( constants . EVENT_DELAY_BEGIN , rootSuite ) ;
940
940
rootSuite . once ( EVENT_ROOT_SUITE_RUN , start ) ;
941
941
} else {
942
- start ( ) ;
942
+ Runner . immediately ( function ( ) {
943
+ start ( ) ;
944
+ } ) ;
943
945
}
944
946
945
947
return this ;
Original file line number Diff line number Diff line change @@ -487,6 +487,16 @@ describe('Mocha', function() {
487
487
} , 'not to throw' ) ;
488
488
} ) ;
489
489
490
+ it ( 'should catch the `start` event if no tests are provided' , function ( done ) {
491
+ var mocha = new Mocha ( opts ) ;
492
+ mocha . run ( ) . on ( 'start' , done ) ;
493
+ } ) ;
494
+
495
+ it ( 'should catch the `end` event if no tests are provided' , function ( done ) {
496
+ var mocha = new Mocha ( opts ) ;
497
+ mocha . run ( ) . on ( 'end' , done ) ;
498
+ } ) ;
499
+
490
500
describe ( '#reporter("xunit")#run(fn)' , function ( ) {
491
501
// :TBD: Why does specifying reporter differentiate this test from preceding one
492
502
it ( 'should not raise errors if callback was not provided' , function ( ) {
You can’t perform that action at this time.
0 commit comments