Hi all, I am attempting to run my tests with Jest...
# pact-js
a
Hi all, I am attempting to run my tests with Jest. When I run then on windows, everything works fine. However, when I run the tests inside a docker linux container, I encounter some issues. The dockerfile to create a container is as follows:
Copy code
FROM node:19

RUN apt-get update -y && \
    apt-get install -y git g++ python3 build-essential && \
    rm -rf /var/lib/apt/lists/* 

RUN apt-get install -y bash

CMD ["bash"]
To run this container, I create a volume to acces the react app code from within container:
Copy code
wsl docker run -it -v /mnt/c/source/my-project:/src my-project-test:my-project-test
After that, I attempt to run tests with Jest inside the container:
Copy code
jest --testPathPattern "/src/services" --env=jsdom
However, it is not work. With debian and ubuntu the bash stays frozen for hours (see image bellow). Could someone help me, please?
To provide better context, the image will be shared among many teams to create GitLab pipelines. Once the container is allocated, a script to run tests will be executed.
v
Hi @Anna Lorenzi , i dont know what would cause it but I have a couple of ideas to find out more answer. Have you tried running any other jest tests inside the container? Basically reduce the scope of your problem until you find where the problem lives. Jest should also have a verbose option
m
Note if you volume mount a windows volume into a Linux container any node modules will need to be reinstalled, because any that require native compilation etc won't work. I like Vittorio's advice though. Remove pact from the test - does that work?