Skip to content

Commit 1b9e560

Browse files
committed
🐛 fix for invalid cypress version in cypress dependency
1 parent aac35d7 commit 1b9e560

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

bin/helpers/utils.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -333,14 +333,10 @@ exports.setCypressNpmDependency = (bsConfig) => {
333333
if (runSettings.npm_dependencies !== undefined &&
334334
Object.keys(runSettings.npm_dependencies).length !== 0 &&
335335
typeof runSettings.npm_dependencies === 'object') {
336-
if (!("cypress" in runSettings.npm_dependencies)) {
336+
if (!("cypress" in runSettings.npm_dependencies) && Constants.CYPRESS_V10_AND_ABOVE_TYPE) {
337337
logger.warn("Missing cypress not found in npm_dependencies");
338338
if("cypress_version" in runSettings){
339-
if(runSettings.cypress_version.toString().match(Constants.LATEST_VERSION_SYNTAX_REGEX)){
340-
runSettings.npm_dependencies.cypress = `^${runSettings.cypress_version.toString().split(".")[0]}`
341-
} else {
342-
runSettings.npm_dependencies.cypress = runSettings.cypress_version;
343-
}
339+
runSettings.npm_dependencies.cypress = `^${runSettings.cypress_version.toString().split(".")[0]}`;
344340
} else if (runSettings.cypressTestSuiteType === Constants.CYPRESS_V10_AND_ABOVE_TYPE) {
345341
runSettings.npm_dependencies.cypress = "latest";
346342
}

test/unit/bin/helpers/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3582,7 +3582,7 @@ describe('utils', () => {
35823582
},
35833583
};
35843584
utils.setCypressNpmDependency(bsConfig);
3585-
chai.assert.equal(bsConfig.run_settings.npm_dependencies.cypress, "10.0.0");
3585+
chai.assert.equal(bsConfig.run_settings.npm_dependencies.cypress, "^10");
35863586
});
35873587

35883588
it('should not set cypress for < 9 cypress version if cypress_version missing', () => {

0 commit comments

Comments
 (0)