Skip to content

Commit f3ad38d

Browse files
committed
Run mocha tests via Docker.
1 parent 7aa52dd commit f3ad38d

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

docker-compose.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ services:
77
- ${SERVER_HOST:-127.0.0.1}:${SERVER_PORT-}:80
88
volumes:
99
- .:/var/www/html
10+
mocha:
11+
build: test
12+
command: http://example/test
13+
volumes:
14+
- .:/var/www/html
15+
depends_on:
16+
- example
1017
chromedriver:
1118
image: blueimp/chromedriver
1219
init: true

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@
8686
},
8787
"scripts": {
8888
"lint": "stylelint '**/*.css' && eslint .",
89-
"preunit": "docker-compose up -d example",
90-
"unit": "mocha-chrome http://localhost/test",
89+
"unit": "docker-compose run --rm mocha",
9190
"wdio": "docker-compose run --rm wdio",
9291
"test": "npm run lint && npm run unit && npm run wdio && npm run wdio -- firefox",
9392
"posttest": "docker-compose down -v",

test/Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM blueimp/chromedriver
2+
3+
USER root
4+
5+
RUN export DEBIAN_FRONTEND=noninteractive \
6+
&& apt-get update \
7+
&& apt-get install --no-install-recommends --no-install-suggests -y \
8+
nodejs \
9+
npm \
10+
# Remove obsolete files:
11+
&& npm install -g \
12+
npm@latest \
13+
mocha-chrome \
14+
&& apt-get clean \
15+
&& rm -rf \
16+
/tmp/* \
17+
/usr/share/doc/* \
18+
/var/cache/* \
19+
/var/lib/apt/lists/* \
20+
/var/tmp/*
21+
22+
USER webdriver
23+
24+
WORKDIR /var/www/html
25+
26+
ENTRYPOINT ["mocha-chrome"]

0 commit comments

Comments
 (0)