mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-05 06:20:44 -05:00
clear version state when forcing install of verify
This commit is contained in:
@@ -16,7 +16,9 @@ const install = (options = {}) => {
|
||||
})
|
||||
.then((installedVersion) => {
|
||||
if (options.force) {
|
||||
throw new Error('')
|
||||
return utils.clearVersionState().then(() => {
|
||||
throw new Error('')
|
||||
})
|
||||
} else if (installedVersion === packageVersion) {
|
||||
utils.log(chalk.green(`Cypress ${packageVersion} already installed.`))
|
||||
} else {
|
||||
|
||||
+11
-1
@@ -45,6 +45,12 @@ const ensureInstallationDir = () => {
|
||||
return fs.ensureDirAsync(getInstallationDir())
|
||||
}
|
||||
|
||||
const clearVersionState = () => {
|
||||
return ensureFileInfoContents().then((contents) => {
|
||||
return writeInfoFileContents(_.omit(contents, 'version', 'verifiedVersion'))
|
||||
})
|
||||
}
|
||||
|
||||
const writeInstalledVersion = (version) => {
|
||||
return ensureFileInfoContents().then((contents) => {
|
||||
return writeInfoFileContents(_.extend(contents, { version }))
|
||||
@@ -137,7 +143,9 @@ const checkIfVerified = (options) => {
|
||||
.then((verifiedVersion) => {
|
||||
if (options.force || verifiedVersion !== packageVersion) {
|
||||
log(chalk.green('⧖ Verifying Cypress executable...'))
|
||||
return runSmokeTest().then(() => {
|
||||
return writeVerifiedVersion(null)
|
||||
.then(runSmokeTest)
|
||||
.then(() => {
|
||||
log()
|
||||
log(chalk.green('✓ Successfully verified Cypress executable'))
|
||||
return writeVerifiedVersion(packageVersion)
|
||||
@@ -157,6 +165,7 @@ const checkIfVerified = (options) => {
|
||||
log('----------')
|
||||
log('Platform:', os.platform())
|
||||
log('Version:', version)
|
||||
process.exit(1)
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -191,6 +200,7 @@ const verify = (options = {}) => {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
clearVersionState,
|
||||
ensureInstallationDir,
|
||||
getInstallationDir,
|
||||
getInstalledVersion,
|
||||
|
||||
Reference in New Issue
Block a user