diff --git a/bin/helpers/utils.js b/bin/helpers/utils.js index dd32e487..b91260f4 100644 --- a/bin/helpers/utils.js +++ b/bin/helpers/utils.js @@ -333,14 +333,10 @@ exports.setCypressNpmDependency = (bsConfig) => { if (runSettings.npm_dependencies !== undefined && Object.keys(runSettings.npm_dependencies).length !== 0 && typeof runSettings.npm_dependencies === 'object') { - if (!("cypress" in runSettings.npm_dependencies)) { + if (!("cypress" in runSettings.npm_dependencies) && Constants.CYPRESS_V10_AND_ABOVE_TYPE) { logger.warn("Missing cypress not found in npm_dependencies"); if("cypress_version" in runSettings){ - if(runSettings.cypress_version.toString().match(Constants.LATEST_VERSION_SYNTAX_REGEX)){ - runSettings.npm_dependencies.cypress = `^${runSettings.cypress_version.toString().split(".")[0]}` - } else { - runSettings.npm_dependencies.cypress = runSettings.cypress_version; - } + runSettings.npm_dependencies.cypress = `^${runSettings.cypress_version.toString().split(".")[0]}`; } else if (runSettings.cypressTestSuiteType === Constants.CYPRESS_V10_AND_ABOVE_TYPE) { runSettings.npm_dependencies.cypress = "latest"; } diff --git a/test/unit/bin/helpers/utils.js b/test/unit/bin/helpers/utils.js index 9aa7b16c..09ed222a 100644 --- a/test/unit/bin/helpers/utils.js +++ b/test/unit/bin/helpers/utils.js @@ -3582,7 +3582,7 @@ describe('utils', () => { }, }; utils.setCypressNpmDependency(bsConfig); - chai.assert.equal(bsConfig.run_settings.npm_dependencies.cypress, "10.0.0"); + chai.assert.equal(bsConfig.run_settings.npm_dependencies.cypress, "^10"); }); it('should not set cypress for < 9 cypress version if cypress_version missing', () => {