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

Problem running inside docker container #41

Open
fredcido opened this issue Apr 21, 2021 · 3 comments
Open

Problem running inside docker container #41

fredcido opened this issue Apr 21, 2021 · 3 comments

Comments

@fredcido
Copy link

Hello all, I am trying to run the tests inside a docker container, following the steps, using the following configuration:

FROM node:14

RUN apt-get update -y && apt-get install -y xvfb
ENV DISPLAY=':99'
RUN Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
RUN npm test

However, the tests hang, with no error message at all, I can't even get a clue on what's going on:

npm test

> [email protected] test /app
> jest "--selectProjects" "e2e" "--verbose"

Running one project: e2e

Test Suites: 0 of 5 total
Tests:       0 total
Snapshots:   0 total
Time:        422 s

Any hint on what's going on? I can't see any log messages

@dietergeerts
Copy link

With the same setup as above, i do get the error:

events.js:292
 throw er; // Unhandled 'error' event
 ^

Error: spawn /app/common/temp/node_modules/.pnpm/[email protected]/node_modules/electron/dist/electron ENOENT
 at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
 at onErrorNT (internal/child_process.js:465:16)
 at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on ChildProcess instance at:
 at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
 at onErrorNT (internal/child_process.js:465:16)
 at processTicksAndRejections (internal/process/task_queues.js:80:21) {
 errno: -2,
 code: 'ENOENT',
 syscall: 'spawn /app/common/temp/node_modules/.pnpm/[email protected]/node_modules/electron/dist/electron',
 path: '/app/common/temp/node_modules/.pnpm/[email protected]/node_modules/electron/dist/electron',
 spawnargs: [
 '/app/common/temp/node_modules/.pnpm/[email protected][email protected]/node_modules/jest-electron/lib/electron/main/index'
 ]
}

@hustcc
Copy link
Owner

hustcc commented Nov 3, 2021

maybe new version 0.1.12 solved it.

@sta-ger
Copy link

sta-ger commented Jun 13, 2023

jest-electron does not throw error if some library is missing. I managed to solve this by installing the system libraries needed to run Electron headless and running "npm test" with "xvfb-run":

FROM node:14

COPY . /usr/src/app
WORKDIR /usr/src/app

ENV JEST_ELECTRON_STARTUP_ARGS='--no-sandbox'

RUN apt-get update && apt-get install -y  \
    libnss3  \
    libatk1.0-0  \
    libatk-bridge2.0-0  \
    libgbm1  \
    libgtk-3-0  \
    libasound2  \
    xvfb

RUN npm ci

CMD xvfb-run npm test

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

No branches or pull requests

4 participants