mirror of
https://github.com/cypress-io/cypress.git
synced 2026-04-30 03:51:21 -05:00
49f5b3e80c
* 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
136 lines
3.7 KiB
JavaScript
136 lines
3.7 KiB
JavaScript
require('../../spec_helper')
|
|
|
|
const snapshot = require('../../support/snapshot')
|
|
|
|
const util = require(`${lib}/util`)
|
|
const run = require(`${lib}/exec/run`)
|
|
const spawn = require(`${lib}/exec/spawn`)
|
|
const verify = require(`${lib}/tasks/verify`)
|
|
|
|
describe('exec run', function () {
|
|
beforeEach(function () {
|
|
sinon.stub(util, 'isInstalledGlobally').returns(true)
|
|
sinon.stub(process, 'exit')
|
|
})
|
|
|
|
context('.processRunOptions', function () {
|
|
it('passes --browser option', () => {
|
|
const args = run.processRunOptions({
|
|
browser: 'test browser',
|
|
})
|
|
|
|
snapshot(args)
|
|
})
|
|
|
|
it('passes --record option', () => {
|
|
const args = run.processRunOptions({
|
|
record: 'my record id',
|
|
})
|
|
|
|
snapshot(args)
|
|
})
|
|
|
|
it('passes --config-file false option', () => {
|
|
const args = run.processRunOptions({
|
|
configFile: false,
|
|
})
|
|
|
|
snapshot(args)
|
|
})
|
|
|
|
it('does not remove --record option when using --browser', () => {
|
|
const args = run.processRunOptions({
|
|
record: 'foo',
|
|
browser: 'test browser',
|
|
})
|
|
|
|
snapshot(args)
|
|
})
|
|
})
|
|
|
|
context('.start', function () {
|
|
beforeEach(function () {
|
|
sinon.stub(spawn, 'start').resolves()
|
|
sinon.stub(verify, 'start').resolves()
|
|
})
|
|
|
|
it('verifies cypress', function () {
|
|
return run.start()
|
|
.then(() => {
|
|
expect(verify.start).to.be.calledOnce
|
|
})
|
|
})
|
|
|
|
it('spawns with --key and xvfb', function () {
|
|
return run.start({ port: '1234' })
|
|
.then(() => {
|
|
expect(spawn.start).to.be.calledWith(['--run-project', process.cwd(), '--port', '1234'])
|
|
})
|
|
})
|
|
|
|
it('spawns with --env', function () {
|
|
return run.start({ env: 'host=http://localhost:1337,name=brian' })
|
|
.then(() => {
|
|
expect(spawn.start).to.be.calledWith(['--run-project', process.cwd(), '--env', 'host=http://localhost:1337,name=brian'])
|
|
})
|
|
})
|
|
|
|
it('spawns with --config', function () {
|
|
return run.start({ config: 'watchForFileChanges=false,baseUrl=localhost' })
|
|
.then(() => {
|
|
expect(spawn.start).to.be.calledWith(['--run-project', process.cwd(), '--config', 'watchForFileChanges=false,baseUrl=localhost'])
|
|
})
|
|
})
|
|
|
|
it('spawns with --config-file false', function () {
|
|
return run.start({ configFile: false })
|
|
.then(() => {
|
|
expect(spawn.start).to.be.calledWith(
|
|
['--run-project', process.cwd(), '--config-file', false]
|
|
)
|
|
})
|
|
})
|
|
|
|
it('spawns with --config-file set', function () {
|
|
return run.start({ configFile: 'special-cypress.json' })
|
|
.then(() => {
|
|
expect(spawn.start).to.be.calledWith(
|
|
['--run-project', process.cwd(), '--config-file', 'special-cypress.json']
|
|
)
|
|
})
|
|
})
|
|
|
|
it('spawns with --record false', function () {
|
|
return run.start({ record: false })
|
|
.then(() => {
|
|
expect(spawn.start).to.be.calledWith(['--run-project', process.cwd(), '--record', false])
|
|
})
|
|
})
|
|
|
|
it('spawns with --headed true', function () {
|
|
return run.start({ headed: true })
|
|
.then(() => {
|
|
expect(spawn.start).to.be.calledWith([
|
|
'--run-project', process.cwd(), '--headed', true,
|
|
])
|
|
})
|
|
})
|
|
|
|
it('spawns with --no-exit', function () {
|
|
return run.start({ exit: false })
|
|
.then(() => {
|
|
expect(spawn.start).to.be.calledWith([
|
|
'--run-project', process.cwd(), '--no-exit',
|
|
])
|
|
})
|
|
})
|
|
|
|
it('spawns with --output-path', function () {
|
|
return run.start({ outputPath: '/path/to/output' })
|
|
.then(() => {
|
|
expect(spawn.start).to.be.calledWith(['--run-project', process.cwd(), '--output-path', '/path/to/output'])
|
|
})
|
|
})
|
|
})
|
|
})
|