mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-07 15:09:48 -06:00
- fixes #1264 - fixes #1321 - fixes #1799 - fixes #2689 - fixes #2688 - fixes #2687 - fixes #2686
44 lines
1.1 KiB
JavaScript
44 lines
1.1 KiB
JavaScript
const Promise = require('bluebird')
|
|
const debug = require('debug')('cypress:cli')
|
|
const path = require('path')
|
|
|
|
const util = require('../util')
|
|
const state = require('../tasks/state')
|
|
const { throwFormErrorText, errors } = require('../errors')
|
|
|
|
const getVersions = () => {
|
|
return Promise.try(() => {
|
|
|
|
if (util.getEnv('CYPRESS_RUN_BINARY')) {
|
|
let envBinaryPath = path.resolve(util.getEnv('CYPRESS_RUN_BINARY'))
|
|
|
|
return state.parseRealPlatformBinaryFolderAsync(envBinaryPath)
|
|
.then((envBinaryDir) => {
|
|
if (!envBinaryDir) {
|
|
return throwFormErrorText(errors.CYPRESS_RUN_BINARY.notValid(envBinaryPath))()
|
|
}
|
|
|
|
debug('CYPRESS_RUN_BINARY has binaryDir:', envBinaryDir)
|
|
|
|
return envBinaryDir
|
|
})
|
|
.catch({ code: 'ENOENT' }, (err) => {
|
|
return throwFormErrorText(errors.CYPRESS_RUN_BINARY.notValid(envBinaryPath))(err.message)
|
|
})
|
|
}
|
|
|
|
return state.getBinaryDir()
|
|
})
|
|
.then(state.getBinaryPkgVersionAsync)
|
|
.then((binaryVersion) => {
|
|
return {
|
|
package: util.pkgVersion(),
|
|
binary: binaryVersion || 'not installed',
|
|
}
|
|
})
|
|
}
|
|
|
|
module.exports = {
|
|
getVersions,
|
|
}
|