Skip to content

Commit

Permalink
Revert "always disable xvfb" - it is still needed for Electron
Browse files Browse the repository at this point in the history
This reverts commit 058679f.
  • Loading branch information
flotwig committed Nov 13, 2019
1 parent 8bcdecf commit b4df51b
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions cli/lib/exec/xvfb.js
@@ -1,8 +1,11 @@
const os = require('os')
const Promise = require('bluebird')
const Xvfb = require('@cypress/xvfb')
const { stripIndent } = require('common-tags')
const debug = require('debug')('cypress:cli')
const debugXvfb = require('debug')('cypress:xvfb')
const { throwFormErrorText, errors } = require('../errors')
const util = require('../util')

const xvfb = Promise.promisifyAll(new Xvfb({
timeout: 30000, // milliseconds
Expand Down Expand Up @@ -44,9 +47,33 @@ module.exports = {
},

isNeeded () {
debug('stubbing isNeeded false %o', new Error().stack)
if (os.platform() !== 'linux') {
return false
}

if (process.env.DISPLAY) {
const issueUrl = util.getGitHubIssueUrl(4034)

const message = stripIndent`
DISPLAY environment variable is set to ${process.env.DISPLAY} on Linux
Assuming this DISPLAY points at working X11 server,
Cypress will not spawn own Xvfb
NOTE: if the X11 server is NOT working, Cypress will exit without explanation,
see ${issueUrl}
Solution: Unset the DISPLAY variable and try again:
DISPLAY= npx cypress run ...
`

debug(message)

return false
}

debug('undefined DISPLAY environment variable')
debug('Cypress will spawn its own Xvfb')

return false
return true
},

// async method, resolved with Boolean
Expand Down

0 comments on commit b4df51b

Please sign in to comment.