mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-09 08:00:14 -06:00
* Alphabetize cli options for my own sanity * begin added tag flag * Fix some minor grammar in cli help output + be more specific for specs description * update snapshot based on alphabetization change * update snapshot to include --tag in help output * update logic for pulling out space delimited args to look through --tag and --spec flags dynamically * Support and pass along tag flag to run and record - show err if passed without record flag - sanitize args into comma separated string - display tag in record errors * fix some tests/snapshots where 'tag' was missing * Actually try passing in tag through tests to ensure it prints. * Merge branch 'develop' into issue-2561-tags # Conflicts: # cli/__snapshots__/cli_spec.js # cli/lib/cli.js # cli/lib/exec/run.js # packages/server/lib/modes/run.js # packages/server/lib/util/args.js * Send 'tags' as an array to backend API * Update json-schemas to query against 2.2.0 of postRun - this will require a bump to json-schemas repo * update test to reflect tags array * update snapshot to display nightly tag * rearrange args to alphabetical order in specs * Add tags to runResponses / remove tag from incorrect instance post * Fix failing specs / snapshots * Update error messages + snapshots * Fix snapshot that no longer displays tag arg * fix args unit test * remove extra slash * add a few more cli tests * another test just in case * a quick unit test for displayFlags utility Co-authored-by: Gleb Bahmutov <gleb.bahmutov@gmail.com>
57 lines
1.2 KiB
JavaScript
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.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.env) {
|
|
args.push('--env', options.env)
|
|
}
|
|
|
|
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)
|
|
},
|
|
}
|