11const fs = require ( "fs" ) ;
22const semver = require ( "semver" ) ;
3- const semverCompare = require ( ' semver/functions/compare' ) ;
3+ const semverCompare = require ( " semver/functions/compare" ) ;
44
55const constants = require ( "./constants.js" ) ;
66module . exports = validate_config = function ( lt_config , validation_configs ) {
@@ -51,7 +51,6 @@ module.exports = validate_config = function (lt_config, validation_configs) {
5151 reject ( "Error!! Parallels value not correct" ) ;
5252 }
5353
54-
5554 //Validate if package.json is having the cypress dependency
5655 var cypress_version ;
5756 if ( ! fs . existsSync ( "package.json" ) ) {
@@ -123,7 +122,6 @@ module.exports = validate_config = function (lt_config, validation_configs) {
123122 }
124123
125124 //validate if cypress config file is passed and exists
126-
127125 cypress_version = semver . coerce ( cypress_version ) . version ;
128126 // validate cypress.json only in case of cypress<10
129127 if (
@@ -146,9 +144,16 @@ module.exports = validate_config = function (lt_config, validation_configs) {
146144 reject ( "Error!! Cypress Config File does not has correct json" ) ;
147145 }
148146 }
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+ ) ;
149155 }
150156
151-
152157 if (
153158 lt_config [ "run_settings" ] [ "ignore_files" ] &&
154159 lt_config [ "run_settings" ] [ "ignore_files" ] . length > 0
@@ -238,9 +243,14 @@ module.exports = validate_config = function (lt_config, validation_configs) {
238243 reject (
239244 "Error!! Reporter JSON File has no keys, either remove Key reporter_config_file from lambdatest config or pass some options"
240245 ) ;
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+ ) ;
244254 }
245255 }
246256 } catch {
@@ -250,8 +260,10 @@ module.exports = validate_config = function (lt_config, validation_configs) {
250260 reject ( "Error!! Reporter JSON File does not have correct json" ) ;
251261 }
252262 }
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+ ) ;
255267 }
256268
257269 if (
@@ -342,17 +354,19 @@ module.exports = validate_config = function (lt_config, validation_configs) {
342354 if ( "sys_envs" in lt_config [ "run_settings" ] ) {
343355 let sys_envs = lt_config [ "run_settings" ] [ "sys_envs" ] ;
344356 let envValue ;
345- Object . keys ( sys_envs ) . forEach ( function ( envKey ) {
357+ Object . keys ( sys_envs ) . forEach ( function ( envKey ) {
346358 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+ ) ;
349363 }
350- if ( envValue == undefined || envValue === "" ) {
364+ if ( envValue == undefined || envValue === "" ) {
351365 reject ( "Value of environment variable cannot be left blank" ) ;
352366 }
353- } )
354-
367+ } ) ;
355368 }
369+
356370 resolve ( cypress_version ) ;
357371 } ) ;
358372} ;
0 commit comments