Merge pull request #171 from cypress-io/issue-167

cli: make version mismatch when verifying a warning, close #167
This commit is contained in:
Brian Mann
2017-06-20 10:16:50 -04:00
committed by GitHub
2 changed files with 10 additions and 5 deletions

View File

@@ -196,6 +196,10 @@ const logFailed = () => {
log()
}
const logWarning = (text) => {
log(chalk.yellow(`! ${text}`))
}
function testVersion (version) {
return writeVerifiedVersion(null)
.then(runSmokeTest)
@@ -244,9 +248,10 @@ const verify = (options = {}) => {
if (!installedVersion) {
return explainAndFail(errors.missingApp)(new Error('Missing install'))
} else if (installedVersion !== packageVersion) {
// TODO does this fail if we installed with CYPRESS_VERSION ?!
// warn if we installed with CYPRESS_VERSION or changed version
// in the package.json
const msg = `Installed version (${installedVersion}) does not match package version (${packageVersion})`
return explainAndFail(errors.versionMismatch)(new Error(msg))
logWarning(msg)
}
})
.then(() => {

View File

@@ -206,14 +206,14 @@ describe('utils', function () {
})
})
it('logs error and exits when installed version does not match package version', function () {
it('logs warning when installed version does not match package version', function () {
return utils.writeInstalledVersion('bloop')
.then(() => {
return utils.verify()
})
.then(() => {
expect(this.log).to.be.calledWith('Installed version does not match package version')
expect(process.exit).to.be.calledWith(1)
const warning = chalk.yellow('! Installed version (bloop) does not match package version (0.0.0)')
expect(this.log).to.be.calledWith(warning)
})
})