@@ -1032,7 +1032,7 @@ describe('spec running', function() {
10321032 env . configure ( { autoCleanClosures : false , random : false } ) ;
10331033 } ) ;
10341034
1035- it ( 'should be able to run multiple times' , function ( ) {
1035+ it ( 'should be able to run multiple times' , function ( done ) {
10361036 var actions = [ ] ;
10371037
10381038 env . describe ( 'Suite' , function ( ) {
@@ -1046,15 +1046,16 @@ describe('spec running', function() {
10461046 } ) ;
10471047 } ) ;
10481048
1049- return env . execute ( ) . then ( function ( ) {
1049+ env . execute ( null , function ( ) {
10501050 expect ( actions ) . toEqual ( [ 'spec1' , 'spec2' ] ) ;
1051- return env . execute ( ) . then ( function ( ) {
1051+ env . execute ( null , function ( ) {
10521052 expect ( actions ) . toEqual ( [ 'spec1' , 'spec2' , 'spec1' , 'spec2' ] ) ;
1053+ done ( ) ;
10531054 } ) ;
10541055 } ) ;
10551056 } ) ;
10561057
1057- it ( 'should reset results between runs' , function ( ) {
1058+ it ( 'should reset results between runs' , function ( done ) {
10581059 var specResults = { } ;
10591060 var suiteResults = { } ;
10601061 var firstExecution = true ;
@@ -1093,7 +1094,7 @@ describe('spec running', function() {
10931094 } ) ;
10941095 } ) ;
10951096 env . describe ( 'suite3' , function ( ) {
1096- beforeEach ( function ( ) {
1097+ env . beforeEach ( function ( ) {
10971098 throw new Error ( 'suite 3 fails' ) ;
10981099 } ) ;
10991100 env . it ( 'spec5' , function ( ) { } ) ;
@@ -1107,29 +1108,31 @@ describe('spec running', function() {
11071108 } ) ;
11081109 } ) ;
11091110
1110- return env . execute ( ) . then ( function ( ) {
1111+ env . execute ( null , function ( ) {
11111112 expect ( specResults ) . toEqual ( {
11121113 spec1 : 'failed' ,
11131114 spec2 : 'pending' ,
11141115 spec3 : 'pending' ,
11151116 spec4 : 'failed' ,
1117+ spec5 : 'failed' ,
11161118 spec6 : 'pending' ,
11171119 spec7 : 'pending'
11181120 } ) ;
11191121 expect ( suiteResults ) . toEqual ( {
11201122 suite0 : 'passed' ,
11211123 suite1 : 'passed' ,
11221124 suite2 : 'passed' ,
1123- suite3 : 'failed ' ,
1125+ suite3 : 'passed ' ,
11241126 suite4 : 'pending' ,
11251127 suite5 : 'passed'
11261128 } ) ;
1127- return env . execute ( ) . then ( function ( ) {
1129+ env . execute ( null , function ( ) {
11281130 expect ( specResults ) . toEqual ( {
11291131 spec1 : 'passed' ,
11301132 spec2 : 'passed' ,
11311133 spec3 : 'pending' ,
11321134 spec4 : 'passed' ,
1135+ spec5 : 'failed' ,
11331136 spec6 : 'pending' ,
11341137 spec7 : 'pending'
11351138 } ) ;
@@ -1141,11 +1144,12 @@ describe('spec running', function() {
11411144 suite4 : 'pending' ,
11421145 suite5 : 'passed'
11431146 } ) ;
1147+ done ( ) ;
11441148 } ) ;
11451149 } ) ;
11461150 } ) ;
11471151
1148- it ( 'should execute before and after hooks per run' , function ( ) {
1152+ it ( 'should execute before and after hooks per run' , function ( done ) {
11491153 var timeline = [ ] ;
11501154 var timelineFn = function ( hookName ) {
11511155 return function ( ) {
@@ -1171,16 +1175,17 @@ describe('spec running', function() {
11711175 env . it ( 'spec1' , timelineFn ( 'spec1' ) ) ;
11721176 env . it ( 'spec2' , timelineFn ( 'spec2' ) ) ;
11731177 } ) ;
1174- return env . execute ( ) . then ( function ( ) {
1178+ env . execute ( null , function ( ) {
11751179 expect ( timeline ) . toEqual ( expectedTimeLine ) ;
11761180 timeline = [ ] ;
1177- return env . execute ( ) . then ( function ( ) {
1181+ env . execute ( null , function ( ) {
11781182 expect ( timeline ) . toEqual ( expectedTimeLine ) ;
1183+ done ( ) ;
11791184 } ) ;
11801185 } ) ;
11811186 } ) ;
11821187
1183- it ( 'should be able to filter out different tests in subsequent runs' , function ( ) {
1188+ it ( 'should be able to filter out different tests in subsequent runs' , function ( done ) {
11841189 var specResults = { } ;
11851190 var focussedSpec = 'spec1' ;
11861191
@@ -1202,33 +1207,30 @@ describe('spec running', function() {
12021207 env . it ( 'spec3' , function ( ) { } ) ;
12031208 } ) ;
12041209
1205- return env
1206- . execute ( )
1207- . then ( function ( ) {
1208- expect ( specResults ) . toEqual ( {
1209- spec1 : 'passed' ,
1210- spec2 : 'excluded' ,
1211- spec3 : 'excluded'
1212- } ) ;
1213- focussedSpec = 'spec2' ;
1214- return env . execute ( ) ;
1215- } )
1216- . then ( function ( ) {
1210+ env . execute ( null , function ( ) {
1211+ expect ( specResults ) . toEqual ( {
1212+ spec1 : 'passed' ,
1213+ spec2 : 'excluded' ,
1214+ spec3 : 'excluded'
1215+ } ) ;
1216+ focussedSpec = 'spec2' ;
1217+ env . execute ( null , function ( ) {
12171218 expect ( specResults ) . toEqual ( {
12181219 spec1 : 'excluded' ,
12191220 spec2 : 'passed' ,
12201221 spec3 : 'excluded'
12211222 } ) ;
12221223 focussedSpec = 'spec3' ;
1223- return env . execute ( ) ;
1224- } )
1225- . then ( function ( ) {
1226- expect ( specResults ) . toEqual ( {
1227- spec1 : 'excluded' ,
1228- spec2 : 'excluded' ,
1229- spec3 : 'passed'
1224+ env . execute ( null , function ( ) {
1225+ expect ( specResults ) . toEqual ( {
1226+ spec1 : 'excluded' ,
1227+ spec2 : 'excluded' ,
1228+ spec3 : 'passed'
1229+ } ) ;
1230+ done ( ) ;
12301231 } ) ;
12311232 } ) ;
1233+ } ) ;
12321234 } ) ;
12331235 } ) ;
12341236} ) ;
0 commit comments