Files
cypress/cli/test/exec/open_spec.js
Brian Mann 101aac9c9b cli: move cli into subfolder, refactor cli scripts
-cleanup root monorepo files
-prevent downloading cypress binary when in development
-remove app-module-path
2017-06-05 17:26:51 -04:00

48 lines
1.5 KiB
JavaScript

require('../spec_helper')
const downloadUtils = require('../../lib/download/utils')
const spawn = require('../../lib/exec/spawn')
const open = require('../../lib/exec/open')
describe('exec open', function () {
context('#start', function () {
beforeEach(function () {
this.sandbox.stub(downloadUtils, 'verify').resolves()
this.sandbox.stub(spawn, 'start').resolves()
})
it('verifies download', function () {
return open.start().then(() => {
expect(downloadUtils.verify).to.be.called
})
})
it('calls spawn with correct options', function () {
return open.start().then(() => {
expect(spawn.start).to.be.calledWith([], {
detached: true,
stdio: ['ignore', 'ignore', 'ignore'],
})
})
})
it('spawns with port', function () {
return open.start({ port: '1234' }).then(() => {
expect(spawn.start).to.be.calledWith(['--port', '1234'])
})
})
it('spawns --project with --env', function () {
return open.start({ env: 'host=http://localhost:1337,name=brian' }).then(() => {
expect(spawn.start).to.be.calledWith(['--env', 'host=http://localhost:1337,name=brian'])
})
})
it('spawns --project with --config', function () {
return open.start({ config: 'watchForFileChanges=false,baseUrl=localhost' }).then(() => {
expect(spawn.start).to.be.calledWith(['--config', 'watchForFileChanges=false,baseUrl=localhost'])
})
})
})
})