@@ -19,18 +19,21 @@ module.exports = validate_config = function (lt_config) {
19
19
) {
20
20
reject ( "Error!!! Auth details not correct" ) ;
21
21
}
22
+
22
23
//Validate spec file
23
24
if ( ! ( "specs" in lt_config [ "run_settings" ] ) ) {
24
25
reject ( "Error!! please provide specs key" ) ;
25
26
} else if ( lt_config [ "run_settings" ] [ "specs" ] . length == 0 ) {
26
27
reject ( "Error!! Please provide specs, specs list can not be empty" ) ;
27
28
}
29
+
28
30
//validate if browsers are not empty
29
31
if ( ! ( "browsers" in lt_config ) ) {
30
32
reject ( "Error!! please provide browsers" ) ;
31
33
} else if ( lt_config [ "browsers" ] . length == 0 ) {
32
34
reject ( "Error!! please provide browsers, browsers list can not be empty" ) ;
33
35
}
36
+
34
37
//validate parellel session
35
38
let parallels = lt_config [ "run_settings" ] [ "parallels" ] ;
36
39
if (
@@ -109,23 +112,39 @@ module.exports = validate_config = function (lt_config) {
109
112
reject ( "Error!! Package.json File does not has correct json" ) ;
110
113
}
111
114
}
115
+
112
116
if (
113
117
lt_config [ "run_settings" ] [ "ignore_files" ] &&
114
118
lt_config [ "run_settings" ] [ "ignore_files" ] . length > 0
115
- ) {
116
- for ( var i = 0 ; i < lt_config [ "run_settings" ] [ "ignore_files" ] . length ; i ++ ) {
117
- if ( lt_config [ "run_settings" ] [ "ignore_files" ] [ i ] == "package.json" ) {
118
- reject ( "package.json is added to ignore_files in run settings, Please remove package.json from ignore_files parameter in lambdatest-config.json file" )
119
- break
119
+ ) {
120
+ for (
121
+ var i = 0 ;
122
+ i < lt_config [ "run_settings" ] [ "ignore_files" ] . length ;
123
+ i ++
124
+ ) {
125
+ if ( lt_config [ "run_settings" ] [ "ignore_files" ] [ i ] == "package.json" ) {
126
+ reject (
127
+ "package.json is added to ignore_files in run settings, Please remove package.json from ignore_files parameter in lambdatest-config.json file"
128
+ ) ;
129
+ break ;
120
130
}
121
131
}
122
132
}
123
133
//validate if network field contains expected value
124
134
if ( "network" in lt_config [ "run_settings" ] ) {
125
- if ( ! ( [ true , false ] . includes ( lt_config [ "run_settings" ] [ "network" ] ) ) ) {
135
+ if ( ! [ true , false ] . includes ( lt_config [ "run_settings" ] [ "network" ] ) ) {
126
136
reject ( "Error!! boolean value is expected in network key" ) ;
127
137
}
128
138
}
139
+
140
+ if ( "downloads" in lt_config [ "run_settings" ] ) {
141
+ let download_folders = lt_config [ "run_settings" ] [ "downloads" ] . split ( "," ) ;
142
+ for ( folder in download_folders ) {
143
+ if ( folder [ 0 ] != "." ) {
144
+ reject ( "Error!! dowloads folder path is not relative " , folder ) ;
145
+ }
146
+ }
147
+ }
129
148
resolve ( "Validated the Config" ) ;
130
149
} ) ;
131
150
} ;
0 commit comments