Skip to content

Commit

Permalink
🐛 fix for invalid cypress version in cypress dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Archish27 committed Feb 20, 2023
1 parent aac35d7 commit 1b9e560
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
8 changes: 2 additions & 6 deletions bin/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down
2 changes: 1 addition & 1 deletion test/unit/bin/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit 1b9e560

Please sign in to comment.