Skip to content
This repository has been archived by the owner on Sep 1, 2021. It is now read-only.

It's not working in Gitlab CI Server #47

Closed
wongjiahau opened this issue Jul 4, 2019 · 2 comments
Closed

It's not working in Gitlab CI Server #47

wongjiahau opened this issue Jul 4, 2019 · 2 comments

Comments

@wongjiahau
Copy link

wongjiahau commented Jul 4, 2019

Configurations

// jest.config.js
module.exports = {
  "roots": [
    "./src"
  ],
  "transform": {
    "^.+\\.tsx?$": "ts-jest"
  },
  runner: '@jest-runner/electron',
  testEnvironment: '@jest-runner/electron/environment',
}

Docker image

nikolaik/python-nodejs:latest

What happened?

The log below is shown after running the jest command, and then it remained hanging and nothing happened after that, no output at all.

> jest --maxWorkers=1

(process:4814): Gtk-WARNING **: Locale not supported by C library.
	Using the fallback 'C' locale.

(electron:4814): Gtk-WARNING **: cannot open display: 
@aaronabramov
Copy link
Contributor

hey @wongjiahau! running electron (or electron tests) require a display (or virtual display), and it seems like your CI server does not support it, hence you get the message

(electron:4814): Gtk-WARNING **: cannot open display:

you can try using another docker image (see circleci configuration for this repo)
https://github.com/facebook-atom/jest-electron-runner/blob/master/.circleci/config.yml#L6

or you can play with things like xvfb to configure a virtual display

@agilgur5
Copy link

agilgur5 commented Nov 26, 2019

Ran into a similar issue on Travis CI -- it would also hang, but it didn't print any errors while it waited, which was quite confusing.

For any future readers, I fixed it by following the links at d4rkr00t/jest-electron-runner#5 (comment).

My Travis CI config looks a bit like this:

language: node_js
node_js: '10.16.0'

# cache folder with Electron binary (https://github.com/electron/electron/blob/master/docs/tutorial/installation.md#cache)
cache:
  directories:
    - ~/.cache

# run with xvfb bc it's needed for Electron (https://docs.travis-ci.com/user/gui-and-headless-browsers/#using-the-xvfb-run-wrapper)
script: xvfb-run npm test

The caching part isn't mentioned in the Travis headless docs or the Electron headless CI docs, but it is mentioned in Electron's installation docs.

Hopefully this helps some folks! It might be worthwhile to officially document this for anyone who isn't knowledgeable about Electron + CI configuration. Can send a PR if this is agreed to be something that warrants officially documentation!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants