File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 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) {
939939 this . emit ( constants . EVENT_DELAY_BEGIN , rootSuite ) ;
940940 rootSuite . once ( EVENT_ROOT_SUITE_RUN , start ) ;
941941 } else {
942- start ( ) ;
942+ Runner . immediately ( function ( ) {
943+ start ( ) ;
944+ } ) ;
943945 }
944946
945947 return this ;
Original file line number Diff line number Diff line change @@ -487,6 +487,16 @@ describe('Mocha', function() {
487487 } , 'not to throw' ) ;
488488 } ) ;
489489
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+
490500 describe ( '#reporter("xunit")#run(fn)' , function ( ) {
491501 // :TBD: Why does specifying reporter differentiate this test from preceding one
492502 it ( 'should not raise errors if callback was not provided' , function ( ) {
You can’t perform that action at this time.
0 commit comments