Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Enable frontend unit tests in docker (#9480)

Benjamin Bädorf4f0850d2085a
diff --git a/docker-compose.yml b/docker-compose.yml
index 0814baecc36..983c6c83a95 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -116,12 +116,13 @@ services:
frontend-test:
build:
<<: *frontend-build
- command: "npm run serve-test"
+ command: "npm run serve:test"
volumes:
- ".:/home/dev/openproject"
- "fedata-test:/home/dev/openproject/public/assets/frontend"
environment:
PROXY_HOSTNAME: backend-test
+ CHROME_BIN: chromium
networks:
- testing
diff --git a/docker/dev/frontend/Dockerfile b/docker/dev/frontend/Dockerfile
index 3e48ff85a20..59afa4702e1 100644
--- a/docker/dev/frontend/Dockerfile
+++ b/docker/dev/frontend/Dockerfile
@@ -6,6 +6,8 @@ ARG DEV_GID=1001
ENV USER=dev
+RUN apt-get update && apt-get install -y chromium
+
RUN npm i -g npm
# `--no-log-init` is required as a workaround to avoid disk exhaustion.
@@ -13,10 +15,10 @@ RUN npm i -g npm
# Read more at:
# * https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#user
# * https://github.com/golang/go/issues/13548
-RUN useradd --no-log-init -d /home/$USER -m $USER -g node
+RUN useradd --no-log-init -d /home/$USER -m $USER -g node || true
-RUN usermod -u $DEV_UID $USER
-RUN groupadd $USER
+RUN usermod -u $DEV_UID $USER || true
+RUN groupadd $USER || true
RUN groupmod -g $DEV_GID $USER || true
EXPOSE 4200
diff --git a/frontend/package.json b/frontend/package.json
index c6256fd064c..de0bc0cdf79 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -131,13 +131,13 @@
"analyze": "ng build --configuration production --stats-json && webpack-bundle-analyzer -h 0.0.0.0 -p 9999 ../public/assets/frontend/stats.json",
"prebuild": "./scripts/link_plugin_placeholder.js",
"build": "node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build --configuration production --named-chunks --extract-css --source-map",
- "build-watch": "node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build --watch --named-chunks --extract-css",
+ "build:watch": "node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build --watch --named-chunks --extract-css",
"preserve": "./scripts/link_plugin_placeholder.js",
"serve": "node --max_old_space_size=8096 ./node_modules/@angular/cli/bin/ng serve --host 0.0.0.0 --public-host http://localhost:4200",
- "serve-test": "node --max_old_space_size=8096 ./node_modules/@angular/cli/bin/ng serve --host 0.0.0.0 --disable-host-check --public-host http://frontend-test:4200",
+ "serve:test": "node --max_old_space_size=8096 ./node_modules/@angular/cli/bin/ng serve --host 0.0.0.0 --disable-host-check --public-host http://frontend-test:4200",
"pretest": "./scripts/link_plugin_placeholder.js",
"test": "ng test --watch=false",
- "test-watch": "ng test --watch=true",
+ "test:watch": "ng test --watch=true",
"lint": "eslint -c .eslintrc.js --ext .ts src/app/",
"lint:fix": "esprint check --fix",
"generate-typings": "tsc -d -p src/tsconfig.app.json"
diff --git a/package.json b/package.json
index 3ea83696ed5..183cd911c7f 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,7 @@
"test": "cd frontend && npm test && cd ..",
"tslint_typechecks": "cd frontend && npm run tslint_typechecks && cd ..",
"serve": "cd frontend && npm run serve",
- "serve-public": "cd frontend && ./node_modules/.bin/ng serve --host 0.0.0.0"
+ "serve:public": "cd frontend && ./node_modules/.bin/ng serve --host 0.0.0.0"
},
"private": true,
"engines": {