mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-26 00:49:05 -06:00
Merge pull request #171 from cypress-io/issue-167
cli: make version mismatch when verifying a warning, close #167
This commit is contained in:
@@ -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(() => {
|
||||
|
||||
@@ -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)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user