How to run unit tests inside Docker container

Viewed 3974

I have created a docker container which runs my angular project and now I'm trying to run my unit tests inside the container unsuccessfully. I need a headless browser to run my tests and PhantomJS is too buggy for my taste, also gives different results with Chrome, when running tests.

Here, I provide my Dockerfile:

# download (or use if it's in cache) the latest official image from node
FROM node:latest

# create directory in the container and set all privileges
RUN mkdir -p /usr/src/app && chmod 777 /usr/src/app

# make the directory available for following commands
WORKDIR /usr/src/app

# copy all local's frontend content to the WORKDIR
COPY . /usr/src/app

# Expose the port the app runs in
EXPOSE 4200

CMD ["npm", "start"]

I tried using Headless Chrome, but still it needs some more configuration that I don't know how to do it. Anyone having any thoughts?

2 Answers
Related