Files
cypress/cli/lib/exec/xvfb.js
Gleb Bahmutov 8e1776c870 Issue 146: uniform CLI error reporting (#149)
* cli: shorter install message without undefined for #146

* cli: show relative path after install

* cli: debug install process

* cli: print message if using CYPRESS_VERSION

* cli: tests for CYPRESS_VERSION install

* cli: needed version message

* cli: verify app after download on install

* cli: do not verify app on install, wait until it runs

* cli: add verify command

* cli: good messags for missing app binary

* cli: xvfb error

* add missing app error

* linting

* cli: errors reported using same function

* print stack in error message for some errors

* show path checked

* use same error mechanism for download errors

* cli: unzip should report error the same way as the rest of CLI

* update some error language

* consolidate urls in error messages

* show terminal info

* terminal check outside of code

* cli: detect CI, do not use progress bar

* cli: test mock bar

* remove context.only
2017-06-09 17:37:48 -04:00

33 lines
672 B
JavaScript

const os = require('os')
const Promise = require('bluebird')
const Xvfb = require('xvfb')
const R = require('ramda')
const debug = require('debug')('cypress:cli')
const xvfb = Promise.promisifyAll(new Xvfb({ silent: true }))
module.exports = {
start () {
return xvfb.startAsync()
},
stop () {
return xvfb.stopAsync()
},
isNeeded () {
return os.platform() === 'linux' && !process.env.DISPLAY
},
// async method, resolved with Boolean
verify () {
return xvfb.startAsync()
.then(R.T)
.catch((err) => {
debug('Could not verify xvfb: %s', err.message)
return false
})
.finally(xvfb.stopAsync)
},
}