Skip to content

Commit 9b1677f

Browse files
committed
test: Setup to run unit tests with Evolene
1 parent d38d858 commit 9b1677f

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

docker-compose-unit-tests.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
version: '3.2'
2+
3+
services:
4+
#############################################
5+
# Start app as a container
6+
#############################################
7+
web:
8+
# if not --build and kursplan-api already exists in
9+
# your local computers registry 'image' is used.
10+
image: $LOCAL_IMAGE_ID
11+
12+
# Since we do not want to add tests to our
13+
# production image. We mount the catalog
14+
# 'test' on in the repo on your local machine
15+
# to /application on the inside of the container.
16+
# The volume mount is done at startup.
17+
volumes:
18+
- ./test:/application/test
19+
20+
tty: true
21+
22+
# The unit test command that triggers tests to be run
23+
# inside the container
24+
command: ['sh', '-c', 'npm install --development && npm test']

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"vendor": "parcel build ./public/js/vendor.js",
1616
"test": "jest --forceExit",
1717
"test:watch": "jest --watch",
18+
"test-unit-in-docker": "ID=$(docker build -q .) && LOCAL_IMAGE_ID=$ID docker-compose -f docker-compose-unit-tests.yml up --abort-on-container-exit --always-recreate-deps",
1819
"docker": "npm install --development && npm run build && npm prune --production",
1920
"build": "NODE_ENV=production rm -rf dist && parcel build ./public/js/app/app.jsx && npm run vendor --preserve-comments",
2021
"build-dev": "cross-env NODE_ENV=development rm -rf dist && parcel build ./public/js/vendor.js --public-url /kurs-pm/static && parcel watch ./public/js/app/app.jsx --public-url /kurs-pm/static",

0 commit comments

Comments
 (0)