This repository was archived by the owner on Jul 29, 2024. It is now read-only.
File tree 6 files changed +73
-3
lines changed
6 files changed +73
-3
lines changed Original file line number Diff line number Diff line change @@ -140,8 +140,12 @@ Runner.prototype.loadDriverProvider_ = function() {
140
140
*/
141
141
Runner . prototype . exit_ = function ( exitCode ) {
142
142
if ( typeof this . config_ . onCleanUp === 'function' ) {
143
- this . config_ . onCleanUp ( exitCode ) ;
143
+ var val = this . config_ . onCleanUp ( exitCode ) ;
144
+ if ( typeof val === 'number' || q . isPromiseAlike ( val ) ) {
145
+ return val ;
146
+ }
144
147
}
148
+ return exitCode ;
145
149
} ;
146
150
147
151
@@ -277,8 +281,7 @@ Runner.prototype.run = function() {
277
281
} ) . then ( function ( ) {
278
282
var passed = testResult . failedCount === 0 ;
279
283
var exitCode = passed ? 0 : 1 ;
280
- self . exit_ ( exitCode ) ;
281
- return exitCode ;
284
+ return q . when ( self . exit_ ( exitCode ) ) ;
282
285
} ) ;
283
286
} ;
284
287
Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ var scripts = [
7
7
'node lib/cli.js spec/basicConf.js' ,
8
8
'node lib/cli.js spec/multiConf.js' ,
9
9
'node lib/cli.js spec/altRootConf.js' ,
10
+ 'node lib/cli.js spec/onCleanUpAsyncReturnValueConf.js' ,
11
+ 'node lib/cli.js spec/onCleanUpNoReturnValueConf.js' ,
12
+ 'node lib/cli.js spec/onCleanUpSyncReturnValueConf.js' ,
10
13
'node lib/cli.js spec/onPrepareConf.js' ,
11
14
'node lib/cli.js spec/onPrepareFileConf.js' ,
12
15
'node lib/cli.js spec/onPreparePromiseConf.js' ,
Original file line number Diff line number Diff line change
1
+ describe ( 'onCleanUp function in the config' , function ( ) {
2
+ it ( 'should not be affected by tests' , function ( ) {
3
+ expect ( true ) . toBe ( true ) ;
4
+ } ) ;
5
+ } ) ;
Original file line number Diff line number Diff line change
1
+ var env = require ( './environment.js' ) ;
2
+ var q = require ( 'q' ) ;
3
+
4
+ // The main suite of Protractor tests.
5
+ exports . config = {
6
+ seleniumAddress : env . seleniumAddress ,
7
+
8
+ specs : [
9
+ 'onCleanUp/*_spec.js'
10
+ ] ,
11
+
12
+ capabilities : env . capabilities ,
13
+
14
+ baseUrl : env . baseUrl ,
15
+
16
+ onCleanUp : function ( exitCode ) {
17
+ var deferred = q . defer ( ) ;
18
+ setTimeout ( function ( ) {
19
+ deferred . resolve ( exitCode ) ;
20
+ } , 500 ) ;
21
+ return deferred . promise ;
22
+ }
23
+ } ;
Original file line number Diff line number Diff line change
1
+ var env = require ( './environment.js' ) ;
2
+
3
+ // The main suite of Protractor tests.
4
+ exports . config = {
5
+ seleniumAddress : env . seleniumAddress ,
6
+
7
+ specs : [
8
+ 'onCleanUp/*_spec.js'
9
+ ] ,
10
+
11
+ capabilities : env . capabilities ,
12
+
13
+ baseUrl : env . baseUrl ,
14
+
15
+ onCleanUp : function ( exitCode ) {
16
+ // no return
17
+ }
18
+ } ;
Original file line number Diff line number Diff line change
1
+ var env = require ( './environment.js' ) ;
2
+
3
+ // The main suite of Protractor tests.
4
+ exports . config = {
5
+ seleniumAddress : env . seleniumAddress ,
6
+
7
+ specs : [
8
+ 'onCleanUp/*_spec.js'
9
+ ] ,
10
+
11
+ capabilities : env . capabilities ,
12
+
13
+ baseUrl : env . baseUrl ,
14
+
15
+ onCleanUp : function ( exitCode ) {
16
+ return exitCode ;
17
+ }
18
+ } ;
You can’t perform that action at this time.
0 commit comments