Enable frontend unit tests in docker (#9480)

* Enable frontend unit tests in docker

* Update npm command names
This commit is contained in:
Benjamin Bädorf
2021-07-19 12:32:05 +00:00
committed by GitHub
parent a90bbc7834
commit 4f0850d208
4 changed files with 11 additions and 8 deletions
+2 -1
View File
@@ -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
+5 -3
View File
@@ -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
+3 -3
View File
@@ -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"
+1 -1
View File
@@ -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": {