mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-04 14:00:22 -05:00
cli: normalized all start methods
This commit is contained in:
+2
-2
@@ -9,7 +9,7 @@ switch (args.exec) {
|
||||
debug('installing Cypress from NPM')
|
||||
|
||||
require('./lib/tasks/install')
|
||||
.install({ force: args.force })
|
||||
.start({ force: args.force })
|
||||
.catch(util.logErrorExit1)
|
||||
|
||||
break
|
||||
@@ -18,7 +18,7 @@ switch (args.exec) {
|
||||
debug('verifying Cypress')
|
||||
|
||||
require('./lib/tasks/verify')
|
||||
.verify({ force: true }) // always force verification
|
||||
.start({ force: true }) // always force verification
|
||||
.catch(util.logErrorExit1)
|
||||
|
||||
break
|
||||
|
||||
+2
-2
@@ -81,7 +81,7 @@ module.exports = {
|
||||
.description('Installs the Cypress executable matching this package\'s version')
|
||||
.action(() => {
|
||||
require('./tasks/install')
|
||||
.install({ force: true })
|
||||
.start({ force: true })
|
||||
.catch(util.exit1)
|
||||
})
|
||||
|
||||
@@ -90,7 +90,7 @@ module.exports = {
|
||||
.description('Verifies that Cypress is installed correctly and executable')
|
||||
.action(() => {
|
||||
require('./tasks/verify')
|
||||
.verify({ force: true })
|
||||
.start({ force: true })
|
||||
.catch(util.exit1)
|
||||
})
|
||||
|
||||
|
||||
+3
-2
@@ -1,7 +1,7 @@
|
||||
const _ = require('lodash')
|
||||
const debug = require('debug')('cypress:cli')
|
||||
const spawn = require('./spawn')
|
||||
const { verify } = require('../tasks/verify')
|
||||
const verify = require('../tasks/verify')
|
||||
|
||||
const processRunOptions = (options = {}) => {
|
||||
const args = ['--run-project', options.project]
|
||||
@@ -86,6 +86,7 @@ module.exports = {
|
||||
project: process.cwd(),
|
||||
})
|
||||
|
||||
return verify().then(run(options))
|
||||
return verify.start()
|
||||
.then(run(options))
|
||||
},
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ const cp = require('child_process')
|
||||
const Promise = require('bluebird')
|
||||
const debug = require('debug')('cypress:cli')
|
||||
|
||||
const downloadUtils = require('../download/utils')
|
||||
const info = require('../tasks/info')
|
||||
const xvfb = require('./xvfb')
|
||||
const { throwFormErrorText, errors } = require('../errors')
|
||||
|
||||
@@ -18,7 +18,7 @@ module.exports = {
|
||||
|
||||
const spawn = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const cypressPath = downloadUtils.getPathToExecutable()
|
||||
const cypressPath = info.getPathToExecutable()
|
||||
debug('spawning Cypress %s', cypressPath)
|
||||
debug('spawn args %j', args)
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ module.exports = {
|
||||
start () {
|
||||
debug('Starting XVFB')
|
||||
return xvfb.startAsync()
|
||||
.catch(throwFormErrorText(errors.missingXvfb))
|
||||
.catch(throwFormErrorText(errors.missingXvfb))
|
||||
},
|
||||
|
||||
stop () {
|
||||
@@ -28,11 +28,11 @@ module.exports = {
|
||||
// async method, resolved with Boolean
|
||||
verify () {
|
||||
return xvfb.startAsync()
|
||||
.then(R.T)
|
||||
.catch((err) => {
|
||||
debug('Could not verify xvfb: %s', err.message)
|
||||
return false
|
||||
})
|
||||
.finally(xvfb.stopAsync)
|
||||
.then(R.T)
|
||||
.catch((err) => {
|
||||
debug('Could not verify xvfb: %s', err.message)
|
||||
return false
|
||||
})
|
||||
.finally(xvfb.stopAsync)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ const downloadAndUnzip = (version) => {
|
||||
return tasks.run()
|
||||
}
|
||||
|
||||
const install = (options = {}) => {
|
||||
const start = (options = {}) => {
|
||||
debug('installing with options %j', options)
|
||||
|
||||
_.defaults(options, {
|
||||
@@ -202,7 +202,7 @@ const install = (options = {}) => {
|
||||
.then(() => {
|
||||
logger.log('Installing local Cypress binary from %s', needVersion)
|
||||
|
||||
// TODO: move all this shit
|
||||
// TODO: move all this shit, it doesn't work as is now anyway
|
||||
return unzip.start({
|
||||
zipDestination: needVersion,
|
||||
destination: info.getInstallationDir(),
|
||||
@@ -226,5 +226,5 @@ const install = (options = {}) => {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
install,
|
||||
start,
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ const maybeVerify = (options = {}) => {
|
||||
})
|
||||
}
|
||||
|
||||
const verify = (options = {}) => {
|
||||
const start = (options = {}) => {
|
||||
debug('verifying Cypress app')
|
||||
|
||||
_.defaults(options, {
|
||||
@@ -226,7 +226,7 @@ const verify = (options = {}) => {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
verify,
|
||||
start,
|
||||
|
||||
maybeVerify,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user