Skip to content

Commit 7efee20

Browse files
committed
feat(tests): allow tests to run in Docker
1 parent 399dcaa commit 7efee20

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/node_modules

Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM node:10
2+
RUN apt-get update
3+
RUN apt-get install apt-transport-https -y
4+
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
5+
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
6+
RUN apt-get update && apt-get install yarn -y
7+
RUN apt-get install xvfb -y
8+
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
9+
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list && \
10+
apt-get update -y && apt-get install -y --no-install-recommends google-chrome-stable libgconf-2-4 && \
11+
# clean
12+
apt-get clean && rm -rf /var/lib/apt/lists/*
13+
WORKDIR /project
14+
COPY ./package.json ./package.json
15+
COPY ./yarn.lock ./yarn.lock
16+
RUN yarn install
17+
COPY ./ ./
18+
RUN chmod 777 ./docker-entrypoint.sh
19+
ENTRYPOINT [ "./docker-entrypoint.sh" ]

docker-entrypoint.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
xvfb-run yarn test "$@"

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"homepage": "https://nklayman.github.io/vue-cli-plugin-electron-builder/",
77
"scripts": {
88
"test": "jest",
9+
"test:docker": "docker build -t vcpeb . && docker run --rm --name vcpeb vcpeb",
910
"pretest": "rimraf __tests__/projects/*",
1011
"lint": "eslint --ignore-pattern projects ./",
1112
"docs:dev": "vuepress dev docs",

0 commit comments

Comments
 (0)