diff --git a/bin/commands/runs.js b/bin/commands/runs.js index 1d01c32f..2fb7fe45 100644 --- a/bin/commands/runs.js +++ b/bin/commands/runs.js @@ -116,8 +116,13 @@ module.exports = function run(args) { } if (bsConfig.run_settings.cypress_version && bsConfig.run_settings.cypress_version !== data.cypress_version) { - let versionMessage = utils.versionChangedMessage(bsConfig.run_settings.cypress_version, data.cypress_version) - logger.warn(versionMessage); + if (bsConfig.run_settings.cypress_version.match(Constants.LATEST_VERSION_SYNTAX_REGEX)) { + let versionMessage = utils.latestSyntaxToActualVersionMessage(bsConfig.run_settings.cypress_version, data.cypress_version); + logger.info(versionMessage); + } else { + let versionMessage = utils.versionChangedMessage(bsConfig.run_settings.cypress_version, data.cypress_version); + logger.warn(versionMessage); + } } if (!args.disableNpmWarning && bsConfig.run_settings.npm_dependencies && Object.keys(bsConfig.run_settings.npm_dependencies).length <= 0) { diff --git a/bin/helpers/constants.js b/bin/helpers/constants.js index fd397e54..884687c4 100644 --- a/bin/helpers/constants.js +++ b/bin/helpers/constants.js @@ -44,7 +44,8 @@ const userMessages = { LOCAL_START_FAILED: "Local Testing setup failed.", LOCAL_STOP_FAILED: "Local Binary stop failed.", INVALID_LOCAL_MODE_WARNING: "Invalid value specified for local_mode. local_mode: (\"always-on\" | \"on-demand\"). For more info, check out https://www.browserstack.com/docs/automate/cypress/cli-reference", - SPEC_LIMIT_WARNING: "You might not see all your results on the dashboard because of high spec count, please consider reducing the number of spec files in this folder." + SPEC_LIMIT_WARNING: "You might not see all your results on the dashboard because of high spec count, please consider reducing the number of spec files in this folder.", + LATEST_SYNTAX_TO_ACTUAL_VERSION_MESSAGE: "Your build will run using Cypress as you had specified . Read more about supported versions here: http://browserstack.com/docs/automate/cypress/supported-versions" }; const validationMessages = { @@ -170,6 +171,8 @@ const DEFAULT_CYPRESS_SPEC_PATH = "cypress/integration" const SPEC_TOTAL_CHAR_LIMIT = 32243; const METADATA_CHAR_BUFFER_PER_SPEC = 175; +const LATEST_VERSION_SYNTAX_REGEX = /\d*.latest(.\d*)?/gm + module.exports = Object.freeze({ syncCLI, userMessages, @@ -183,5 +186,6 @@ module.exports = Object.freeze({ specFileTypes, DEFAULT_CYPRESS_SPEC_PATH, SPEC_TOTAL_CHAR_LIMIT, - METADATA_CHAR_BUFFER_PER_SPEC + METADATA_CHAR_BUFFER_PER_SPEC, + LATEST_VERSION_SYNTAX_REGEX }); diff --git a/bin/helpers/utils.js b/bin/helpers/utils.js index bceb08f4..345e18ff 100644 --- a/bin/helpers/utils.js +++ b/bin/helpers/utils.js @@ -717,6 +717,12 @@ exports.versionChangedMessage = (preferredVersion, actualVersion) => { return message } +exports.latestSyntaxToActualVersionMessage = (latestSyntaxVersion, actualVersion) => { + let message = Constants.userMessages.LATEST_SYNTAX_TO_ACTUAL_VERSION_MESSAGE.replace("", latestSyntaxVersion); + message = message.replace("", actualVersion); + return message +} + exports.isJSONInvalid = (err, args) => { let invalid = true diff --git a/test/unit/bin/helpers/utils.js b/test/unit/bin/helpers/utils.js index 33063f88..43a7c97a 100644 --- a/test/unit/bin/helpers/utils.js +++ b/test/unit/bin/helpers/utils.js @@ -1890,6 +1890,14 @@ describe('utils', () => { }); }) + describe('#latestSyntaxToActualVersionMessage', () => { + it('should return proper info message with placeholders replaced', () => { + let latestSyntaxVersion = "7.latest", actualVersion = "7.6.0"; + let message = constant.userMessages.LATEST_SYNTAX_TO_ACTUAL_VERSION_MESSAGE.replace("", latestSyntaxVersion).replace("", actualVersion); + expect(utils.latestSyntaxToActualVersionMessage(latestSyntaxVersion, actualVersion)).to.eq(message) + }); + }) + describe('#isJSONInvalid', () => { it('JSON is valid when error is parallel misconfiguration', () => { let error = constant.validationMessages.INVALID_PARALLELS_CONFIGURATION;