File tree Expand file tree Collapse file tree 3 files changed +10
-7
lines changed Expand file tree Collapse file tree 3 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ class Pythagora {
33
33
this . idSeq = 0 ;
34
34
this . requests = { } ;
35
35
this . testingRequests = { } ;
36
- this . loggingEnabled = this . mode === ' capture' ;
36
+ this . loggingEnabled = this . mode === MODES . capture ;
37
37
//todo move all global vars to tempVars
38
38
this . tempVars = { } ;
39
39
Original file line number Diff line number Diff line change
1
+ const MODES = require ( '../const/modes.json' ) ;
1
2
let net = require ( 'net' ) ;
2
3
3
4
const CHUNK_SIZE = 1024 ;
@@ -15,7 +16,7 @@ module.exports = class RedisInterceptor {
15
16
this . listenSocket = net . createServer ( connection => {
16
17
connection . on ( 'data' , data => {
17
18
18
- if ( this . mode === ' capture' ) {
19
+ if ( this . mode === MODES . capture ) {
19
20
this . forwardData ( connection , data , true ) ;
20
21
} else if ( this . mode === 'test' ) {
21
22
Original file line number Diff line number Diff line change 1
- const AVAILABLE_MODES = [ 'capture' , 'test' ] ;
1
+ const MODES = require ( '../const/modes.json' ) ;
2
2
const args = require ( './getArgs.js' ) ;
3
3
const { logAndExit } = require ( './cmdPrint.js' ) ;
4
4
5
+ const AVAILABLE_MODES = Object . keys ( MODES ) ;
6
+
5
7
if ( ! args . mode ) {
6
8
if ( args . rerun_all_failed || args . test_id ) {
7
9
console . log ( 'Mode not provided. Setting to "test".' ) ;
8
10
args . mode = 'test' ;
9
11
} else {
10
- console . log ( ' Mode not provided. Defaulting to "capture".' ) ;
11
- args . mode = ' capture' ;
12
+ console . log ( ` Mode not provided. Defaulting to "${ MODES . capture } ".` ) ;
13
+ args . mode = MODES . capture ;
12
14
}
13
15
} else if ( ! AVAILABLE_MODES . includes ( args . mode ) ) {
14
16
logAndExit ( `Mode "${ args . mode } " not recognized. Available modes are: ${ AVAILABLE_MODES . join ( ', ' ) } ` ) ;
@@ -18,8 +20,8 @@ if (args.rerun_all_failed && args.mode !== 'test') logAndExit(`Flag --rerun_all_
18
20
if ( args . test_id && args . mode !== 'test' ) logAndExit ( `Flag --test-id allowed only in "--mode test"` ) ;
19
21
if ( args . rerun_all_failed && args . test_id ) logAndExit ( `Not allowed to set flags --rerun_all_failed and --test-id at same time.` ) ;
20
22
21
- if ( args . pick && args . mode !== ' capture' ) logAndExit ( `Flag --pick allowed only in "--mode capture"` ) ;
22
- if ( args . ignore && args . mode !== ' capture' ) logAndExit ( `Flag --ignore allowed only in "--mode capture"` ) ;
23
+ if ( args . pick && args . mode !== MODES . capture ) logAndExit ( `Flag --pick allowed only in "--mode ${ MODES . capture } "` ) ;
24
+ if ( args . ignore && args . mode !== MODES . capture ) logAndExit ( `Flag --ignore allowed only in "--mode ${ MODES . capture } "` ) ;
23
25
24
26
console . log ( `Running "${ process . env . PYTHAGORA_CONFIG } " using Pythagora in "${ args . mode . toUpperCase ( ) } " mode.` ) ;
25
27
You can’t perform that action at this time.
0 commit comments