Files
cypress/cli/lib/exec/open.js
Zach Bloomquist ef9b8f7b38 Launch browsers by path: --browser /path/to/browser (#3337)
* adding multiple possible binary names for linux

* windows launcher doesn't consider "binary", so don't pass it

* adding test for multiple binary names

* Stronger typing, clearer variable names

* Stronger typing, clearer variable names

* cleanup

* cleanup

* clean up type- why isn't this being linted?

* Add more aliases (#3217)

* launcher changes to use Browser throughout, also clarifying FoundBrowser/Browser distinction

* wip

* wip

* update tests to expect objects

* removing errant debugger calls

* Fixing tests

* desktop-gui: use displayName for display

* ' -> "

* launcher: add definitions for google chrome beta and unstable

* server: fallthrough to using chrome helper

* server: changes for run mode to pick correct version

* desktop-gui: add displayName to fixtures

* server: isolating bug with runmode

* browser was a string all along

* server: re-promisify browser detection

* launcher: remove chrome-beta for now, needs some more tweaking for that to work 100 percent

* launcher: cleaning up types

* launcher: fix type comflict when filtering browsers (#3258)

* launcher: cast Windows foundbrowsers

* launcher: mapSeries -> map

* launcher: clean up launcher, change 1 call in server to match

* launcher: test that browsers contains what we like it to

* whoops

* server: accept path in runmode

* launcher: changes for detectByPath [wip]

* server: update tests to use new errors

* launcher: error message cleanup

* launcher: detectByPath working with CLI client

* launcher: detectByPath tests

* launcher: cli client for detectByPath

* server: update error msg snapshot

* cli: allow passing --browser to open mode

* server: using --browser=/path/ works in run and open mode!!

* launcher: change displayName of custom browsers

* server: find browser with highest version property by default

* launcher: update tests, clean up types

* server: fix tests

* server: fix tests

* cli: update help snapshots

* launcher: tests

* server: wip

* server, launcher: clean up errors

* server: add unit tests for events

* server: change e2e helper to support custom browser strings in stdout

* server: e2e tests for browser by path

* server: if this break that

* server: clean up and fix? tests

* decoffeeate, entypescriptify

* server: fix test

* cli: fix whitespace

* cli: remove external browser notice

* server: detect a browser to use for the e2e launch-by-path test

* server: make stackTraceLinesRe not match all sentences with 'at' in them

* server, launcher: update 'not found at path' error msg

* server: clean up browser switch

* server: customBrowserPath

* server: update snapshots that were affected by the old stackLineRe

* server: update stubs

* server: update BROWSER_NOT_FOUND_BY_PATH to use error objects

* server: backticks in snapshots break snapshots

* server: forgetting to save without formatting will be my downfall

* server: remove comment

* desktop-gui: make custom browsers chosen

* desktop-gui, launcher: update tests
2019-02-16 15:12:17 -05:00

53 lines
1.1 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.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)
},
}