Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 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

This comment has been minimized.

Copy link
Member

@aaronabramov aaronabramov commented Jul 4, 2019

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

This comment has been minimized.

Copy link

@agilgur5 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 join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.