Files
cypress/cli/lib/exec/open.js
Brian Mann bc6d8f0a4d cli: fixes #838 start cypress in dev by routing through the CLI (#1106)
* cli: fixes #838 start cypress in dev by routing through the CLI

- matches how we run in production better to keep parity and consistency

* cli: add coerceFalse for clarity

* cli: add global flag, update to work with windows

* server: bring into parity with root scripts

* cli: just execute start script directly to work with windows

* cli, server: fixes failing tests
2017-12-24 15:05:29 -05:00

49 lines
998 B
JavaScript

const debug = require('debug')('cypress:cli')
const util = require('../util')
const spawn = require('./spawn')
const verify = require('../tasks/verify')
module.exports = {
start (options = {}) {
if (!util.isInstalledGlobally() && !options.global && !options.project) {
options.project = process.cwd()
}
const args = []
if (options.env) {
args.push('--env', options.env)
}
if (options.config) {
args.push('--config', options.config)
}
if (options.port) {
args.push('--port', options.port)
}
if (options.project) {
args.push('--project', options.project)
}
debug('opening from options %j', options)
debug('command line arguments %j', args)
function open () {
return spawn.start(args, {
dev: options.dev,
detached: Boolean(options.detached),
stdio: 'inherit',
})
}
if (options.dev) {
return open()
}
return verify.start()
.then(open)
},
}