mirror of
https://github.com/cypress-io/cypress.git
synced 2026-04-25 00:19:11 -05:00
cli: verify against installed version not package version when displaying first time opening message
This commit is contained in:
@@ -12,7 +12,7 @@ Cypress Version: 1.2.3
|
||||
|
||||
`
|
||||
|
||||
exports['warning installed version does not match package version 1'] = `
|
||||
exports['warning installed version does not match verified version 1'] = `
|
||||
Installed version bloop does not match the expected package version 1.2.3
|
||||
|
||||
Note: there is no guarantee these versions will work properly together.
|
||||
@@ -85,6 +85,19 @@ Opening Cypress...
|
||||
|
||||
`
|
||||
|
||||
exports['current version has not been verified 2'] = `
|
||||
Installed version 9.8.7 does not match the expected package version 1.2.3
|
||||
|
||||
Note: there is no guarantee these versions will work properly together.
|
||||
|
||||
It looks like this is your first time using Cypress: 9.8.7
|
||||
|
||||
✔ Verified Cypress! /path/to/executable/dir
|
||||
|
||||
Opening Cypress...
|
||||
|
||||
`
|
||||
|
||||
exports['no welcome message 1'] = `
|
||||
It looks like this is your first time using Cypress: 1.2.3
|
||||
|
||||
|
||||
@@ -179,20 +179,18 @@ function testBinary (version) {
|
||||
return tasks.run()
|
||||
}
|
||||
|
||||
const maybeVerify = (options = {}) => {
|
||||
const maybeVerify = (installedVersion, options = {}) => {
|
||||
return info.getVerifiedVersion()
|
||||
.then((verifiedVersion) => {
|
||||
const packageVersion = util.pkgVersion()
|
||||
|
||||
debug('has verified version', verifiedVersion)
|
||||
|
||||
// verify if packageVersion and verifiedVersion are different
|
||||
const shouldVerify = options.force || differentFrom(packageVersion, verifiedVersion)
|
||||
const shouldVerify = options.force || differentFrom(installedVersion, verifiedVersion)
|
||||
|
||||
debug('run verification check?', shouldVerify)
|
||||
|
||||
if (shouldVerify) {
|
||||
return testBinary(packageVersion)
|
||||
return testBinary(installedVersion)
|
||||
.then(() => {
|
||||
if (options.welcomeMessage) {
|
||||
logger.log()
|
||||
@@ -238,7 +236,7 @@ const start = (options = {}) => {
|
||||
logger.log()
|
||||
}
|
||||
|
||||
return maybeVerify(options)
|
||||
return maybeVerify(installedVersion, options)
|
||||
})
|
||||
.catch((err) => {
|
||||
if (err.known) {
|
||||
|
||||
@@ -117,7 +117,7 @@ context('.verify', function () {
|
||||
})
|
||||
})
|
||||
|
||||
it('logs warning when installed version does not match package version', function () {
|
||||
it('logs warning when installed version does not match verified version', function () {
|
||||
const ctx = this
|
||||
|
||||
this.sandbox.stub(fs, 'statAsync')
|
||||
@@ -137,7 +137,7 @@ context('.verify', function () {
|
||||
})
|
||||
.catch(() => {
|
||||
snapshot(
|
||||
'warning installed version does not match package version',
|
||||
'warning installed version does not match verified version',
|
||||
normalize(ctx.stdout.toString())
|
||||
)
|
||||
})
|
||||
@@ -282,7 +282,32 @@ context('.verify', function () {
|
||||
})
|
||||
})
|
||||
|
||||
it('turns off Opening Cypres...', function () {
|
||||
it('logs and runs when installed version is different than verified version', function () {
|
||||
const ctx = this
|
||||
|
||||
return info.writeInfoFileContents({
|
||||
version: '9.8.7',
|
||||
verifiedVersion: packageVersion,
|
||||
})
|
||||
.then(() => {
|
||||
return verify.start()
|
||||
})
|
||||
.then(() => {
|
||||
return info.getVerifiedVersion()
|
||||
})
|
||||
.then((vv) => {
|
||||
expect(vv).to.eq('9.8.7')
|
||||
})
|
||||
.delay(100) // give a little padding for listr
|
||||
.then(() => {
|
||||
snapshot(
|
||||
'current version has not been verified',
|
||||
normalize(ctx.stdout.toString())
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
it('turns off Opening Cypress...', function () {
|
||||
const ctx = this
|
||||
|
||||
return info.writeInfoFileContents({
|
||||
|
||||
Reference in New Issue
Block a user