@@ -10,52 +10,50 @@ import {Runner} from './runner';
10
10
let logger = new Logger ( 'runnerCli' ) ;
11
11
12
12
process . on ( 'message' , ( m : any ) => {
13
- switch ( m . command ) {
14
- case 'run' :
15
- if ( ! m . capabilities ) {
16
- throw new Error ( 'Run message missing capabilities' ) ;
17
- }
18
- // Merge in config file options.
19
- let configParser = new ConfigParser ( ) ;
20
- if ( m . configFile ) {
21
- configParser . addFileConfig ( m . configFile ) ;
22
- }
23
- if ( m . additionalConfig ) {
24
- configParser . addConfig ( m . additionalConfig ) ;
25
- }
26
- let config = configParser . getConfig ( ) ;
27
- Logger . set ( config ) ;
28
-
29
- // Grab capabilities to run from launcher.
30
- config . capabilities = m . capabilities ;
31
-
32
- // Get specs to be executed by this runner
33
- config . specs = m . specs ;
34
-
35
- // Launch test run.
36
- let runner = new Runner ( config ) ;
37
-
38
- // Pipe events back to the launcher.
39
- runner . on ( 'testPass' , ( ) => {
40
- process . send ( { event : 'testPass' } ) ;
41
- } ) ;
42
- runner . on ( 'testFail' , ( ) => {
43
- process . send ( { event : 'testFail' } ) ;
44
- } ) ;
45
- runner . on ( 'testsDone' , ( results : any ) => {
46
- process . send ( { event : 'testsDone' , results : results } ) ;
47
- } ) ;
48
-
49
- runner . run ( )
50
- . then ( ( exitCode : number ) => {
51
- process . exit ( exitCode ) ;
52
- } )
53
- . catch ( ( err : Error ) => {
54
- logger . info ( err . message ) ;
55
- process . exit ( 1 ) ;
56
- } ) ;
57
- break ;
58
- default :
59
- throw new Error ( 'command ' + m . command + ' is invalid' ) ;
13
+ if ( m . command === 'run' ) {
14
+ if ( ! m . capabilities ) {
15
+ throw new Error ( 'Run message missing capabilities' ) ;
16
+ }
17
+ // Merge in config file options.
18
+ let configParser = new ConfigParser ( ) ;
19
+ if ( m . configFile ) {
20
+ configParser . addFileConfig ( m . configFile ) ;
21
+ }
22
+ if ( m . additionalConfig ) {
23
+ configParser . addConfig ( m . additionalConfig ) ;
24
+ }
25
+ let config = configParser . getConfig ( ) ;
26
+ Logger . set ( config ) ;
27
+
28
+ // Grab capabilities to run from launcher.
29
+ config . capabilities = m . capabilities ;
30
+
31
+ // Get specs to be executed by this runner
32
+ config . specs = m . specs ;
33
+
34
+ // Launch test run.
35
+ let runner = new Runner ( config ) ;
36
+
37
+ // Pipe events back to the launcher.
38
+ runner . on ( 'testPass' , ( ) => {
39
+ process . send ( { event : 'testPass' } ) ;
40
+ } ) ;
41
+ runner . on ( 'testFail' , ( ) => {
42
+ process . send ( { event : 'testFail' } ) ;
43
+ } ) ;
44
+ runner . on ( 'testsDone' , ( results : any ) => {
45
+ process . send ( { event : 'testsDone' , results : results } ) ;
46
+ } ) ;
47
+
48
+ runner . run ( )
49
+ . then ( ( exitCode : number ) => {
50
+ process . exit ( exitCode ) ;
51
+ } )
52
+ . catch ( ( err : Error ) => {
53
+ logger . info ( err . message ) ;
54
+ process . exit ( 1 ) ;
55
+ } ) ;
56
+ } else {
57
+ throw new Error ( 'command ' + m . command + ' is invalid' ) ;
60
58
}
61
59
} ) ;
0 commit comments