@@ -61,16 +61,26 @@ Zone.__load_patch('jasmine', (global: any) => {
6161 jasmineEnv [ symbol ( methodName ) ] = originalJasmineFn ;
6262 jasmineEnv [ methodName ] = function (
6363 description : string , specDefinitions : Function , timeout : number ) {
64- arguments [ 1 ] = wrapTestInZone ( specDefinitions ) ;
65- return originalJasmineFn . apply ( this , arguments ) ;
64+ if ( typeof timeout !== 'number' ) {
65+ timeout = ( jasmine as any ) [ symbol ( 'mochaTimeout' ) ] ;
66+ }
67+ const wrappedSpecDef = wrapTestInZone ( specDefinitions ) ;
68+ return originalJasmineFn . apply (
69+ this ,
70+ typeof timeout === 'number' ? [ description , wrappedSpecDef , timeout ] :
71+ [ description , wrappedSpecDef ] ) ;
6672 } ;
6773 } ) ;
6874 [ 'beforeEach' , 'afterEach' ] . forEach ( methodName => {
6975 let originalJasmineFn : Function = jasmineEnv [ methodName ] ;
7076 jasmineEnv [ symbol ( methodName ) ] = originalJasmineFn ;
7177 jasmineEnv [ methodName ] = function ( specDefinitions : Function , timeout : number ) {
72- arguments [ 0 ] = wrapTestInZone ( specDefinitions ) ;
73- return originalJasmineFn . apply ( this , arguments ) ;
78+ if ( typeof timeout !== 'number' ) {
79+ timeout = ( jasmine as any ) [ symbol ( 'mochaTimeout' ) ] ;
80+ }
81+ const wrappedSpecDef = wrapTestInZone ( specDefinitions ) ;
82+ return originalJasmineFn . apply (
83+ this , typeof timeout === 'number' ? [ wrappedSpecDef , timeout ] : [ wrappedSpecDef ] ) ;
7484 } ;
7585 } ) ;
7686
@@ -81,6 +91,19 @@ Zone.__load_patch('jasmine', (global: any) => {
8191 */
8292 function wrapDescribeInZone ( describeBody : Function ) : Function {
8393 return function ( ) {
94+ ( jasmine as any ) [ symbol ( 'mochaTimeout' ) ] = null ;
95+ if ( this && ! this . timeout ) {
96+ this . timeout = function ( timeout : number ) {
97+ ( jasmine as any ) [ symbol ( 'mochaTimeout' ) ] = timeout ;
98+ }
99+ }
100+ if ( this && ! this . skip ) {
101+ this . skip = function ( ) {
102+ if ( typeof global [ 'pending' ] === 'function' ) {
103+ global [ 'pending' ] ( ) ;
104+ }
105+ }
106+ }
84107 return syncZone . run ( describeBody , this , ( arguments as any ) as any [ ] ) ;
85108 } ;
86109 }
0 commit comments