1
1
const fs = require ( "fs" ) ;
2
2
const semver = require ( "semver" ) ;
3
- const semverCompare = require ( ' semver/functions/compare' ) ;
3
+ const semverCompare = require ( " semver/functions/compare" ) ;
4
4
5
5
const constants = require ( "./constants.js" ) ;
6
6
module . exports = validate_config = function ( lt_config , validation_configs ) {
@@ -51,7 +51,6 @@ module.exports = validate_config = function (lt_config, validation_configs) {
51
51
reject ( "Error!! Parallels value not correct" ) ;
52
52
}
53
53
54
-
55
54
//Validate if package.json is having the cypress dependency
56
55
var cypress_version ;
57
56
if ( ! fs . existsSync ( "package.json" ) ) {
@@ -123,7 +122,6 @@ module.exports = validate_config = function (lt_config, validation_configs) {
123
122
}
124
123
125
124
//validate if cypress config file is passed and exists
126
-
127
125
cypress_version = semver . coerce ( cypress_version ) . version ;
128
126
// validate cypress.json only in case of cypress<10
129
127
if (
@@ -146,9 +144,16 @@ module.exports = validate_config = function (lt_config, validation_configs) {
146
144
reject ( "Error!! Cypress Config File does not has correct json" ) ;
147
145
}
148
146
}
147
+ } else if (
148
+ semverCompare ( cypress_version , "10.0.0" ) >= 0 &&
149
+ lt_config [ "run_settings" ] [ "cypress_config_file" ] &&
150
+ lt_config [ "run_settings" ] [ "cypress_config_file" ] != ""
151
+ ) {
152
+ reject (
153
+ 'Error!! --ccf flag or cypress_config_file is not cupported with cypress>=10,use \n --cy="--config-file <file path>"'
154
+ ) ;
149
155
}
150
156
151
-
152
157
if (
153
158
lt_config [ "run_settings" ] [ "ignore_files" ] &&
154
159
lt_config [ "run_settings" ] [ "ignore_files" ] . length > 0
@@ -238,9 +243,14 @@ module.exports = validate_config = function (lt_config, validation_configs) {
238
243
reject (
239
244
"Error!! Reporter JSON File has no keys, either remove Key reporter_config_file from lambdatest config or pass some options"
240
245
) ;
241
- } else if ( reporter_config . reporterEnabled && reporter_config . reporterEnabled != "" ) {
242
- if ( ! reporter_config . reporterEnabled . includes ( "mochawesome" ) ) {
243
- console . log ( "Warning!! mochawesome reporter config not present. Command log may not be visible on dashboard" ) ;
246
+ } else if (
247
+ reporter_config . reporterEnabled &&
248
+ reporter_config . reporterEnabled != ""
249
+ ) {
250
+ if ( ! reporter_config . reporterEnabled . includes ( "mochawesome" ) ) {
251
+ console . log (
252
+ "Warning!! mochawesome reporter config not present. Command log may not be visible on dashboard"
253
+ ) ;
244
254
}
245
255
}
246
256
} catch {
@@ -250,8 +260,10 @@ module.exports = validate_config = function (lt_config, validation_configs) {
250
260
reject ( "Error!! Reporter JSON File does not have correct json" ) ;
251
261
}
252
262
}
253
- } else {
254
- console . log ( "Warning!! Value of reporter_config_file parameter missing. Proceeding with default reporter config" )
263
+ } else {
264
+ console . log (
265
+ "Warning!! Value of reporter_config_file parameter missing. Proceeding with default reporter config"
266
+ ) ;
255
267
}
256
268
257
269
if (
@@ -342,17 +354,19 @@ module.exports = validate_config = function (lt_config, validation_configs) {
342
354
if ( "sys_envs" in lt_config [ "run_settings" ] ) {
343
355
let sys_envs = lt_config [ "run_settings" ] [ "sys_envs" ] ;
344
356
let envValue ;
345
- Object . keys ( sys_envs ) . forEach ( function ( envKey ) {
357
+ Object . keys ( sys_envs ) . forEach ( function ( envKey ) {
346
358
envValue = sys_envs [ envKey ] ;
347
- if ( envKey && ! constants . WHITELISTED_ENV_VARS . includes ( envKey ) ) {
348
- reject ( `Usage of unwanted environment variable detected. Allowed variables are - ${ constants . WHITELISTED_ENV_VARS } ` ) ;
359
+ if ( envKey && ! constants . WHITELISTED_ENV_VARS . includes ( envKey ) ) {
360
+ reject (
361
+ `Usage of unwanted environment variable detected. Allowed variables are - ${ constants . WHITELISTED_ENV_VARS } `
362
+ ) ;
349
363
}
350
- if ( envValue == undefined || envValue === "" ) {
364
+ if ( envValue == undefined || envValue === "" ) {
351
365
reject ( "Value of environment variable cannot be left blank" ) ;
352
366
}
353
- } )
354
-
367
+ } ) ;
355
368
}
369
+
356
370
resolve ( cypress_version ) ;
357
371
} ) ;
358
372
} ;
0 commit comments