Files
cypress/cli/lib/exec/open.js
Zach Bloomquist 49f5b3e80c Introduce --config-file argument (#3246)
* cli, server: introduce --config-file argument

* server: remove unused import

* server: wip

* server: consider --config-file in settings

* server: pass options to settings.read from config

* server: store options in Project class, pass to all settings calls

* server: _initPlugins needs to accept options, for being called from server

* server: accept optional external options in open

* cli: update help snapshots

* server: realizing now that these were written like this so they could be stubbed - removing some unnecessary usages of @options

* cli: pass configFile when it's false

* server: --config-file false and --config-file blah.json work

* server: add unit tests for --config-file

* server: pass configFile to desktop-gui

* desktop-gui: display 'cypress.json' according to --config-file arg

* desktop-gui: add integration tests for --config-file

* cli: add tests for --config-file

* PR changes

* PR changes

* cli: update snapshots

* server: updating error messages

* runner: update cypress.json mention

* fixing name overlap

* server: integration tests for --config-file

* runner: update Header component tests

* cli: fix snapshot

* desktop-gui: fix test

* driver: fixing error messages - not really any visibility to cli args from here so just static strings

* server: update snapshots

* server: update snapshots

* cli: updating snapshot

* driver: how did i miss this?

* add skipped blank line to the snapshot

* fix missing proxy require statement (was lost in merge of develop)...weird

* add module API defs to types

* module API tests

* send better error when config file can't be found

* fix dtslint test

* update cli help to use 'configuration file'

* update snapshot using 7.7.1 in place

* fix failing config_spec

* be.visible

* show custom config file name in driver errors

* add tests for non-default config file in driver error messages

* single-quote config file name

* 🙅 IIFEs 🙅

* 🤦

* fix failing test

* fix failing test, cleanup

* lint

* delete duplicate coffee spec

* Update run.js

* Delete app_spec.js.mp4

* in open mode, only store projects to recents list if 'cypress.json' is the configFile

discussion: https://git.io/JeGyF

* feedback
2019-09-27 10:25:07 -04:00

57 lines
1.2 KiB
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.configFile !== undefined) {
args.push('--config-file', options.configFile)
}
if (options.browser) {
args.push('--browser', options.browser)
}
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)
},
}