From a79947e37acda23128b654938fd873a8668db863 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 13 Apr 2021 23:59:14 +0200 Subject: [PATCH] frontend coverage test & report --- .github/workflows/test.yml | 23 ++++++++++++++++++++++- webapp/package.json | 2 +- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1bca06b08..5760145d5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -238,4 +238,25 @@ jobs: - name: backend | docker-compose run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps webapp - name: webapp | Unit tests - run: docker-compose exec -T webapp yarn test \ No newline at end of file + run: | + docker-compose -v ~/coverage:/app/coverage exec -T webapp yarn test + cp -r ~/coverage ./coverage + ########################################################################## + # COVERAGE REPORT FRONTEND ################################################ + ########################################################################## + # TODO: Maybe remove this later on to avoid spam? + - name: frontend | Coverage report + uses: romeovs/lcov-reporter-action@v0.2.21 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + lcov-file: ./coverage/lcov.info + ########################################################################## + # COVERAGE CHECK FRONTEND ################################################ + ########################################################################## + - name: frontend | Coverage check + uses: devmasx/coverage-check-action@v1.2.0 + with: + type: lcov + result_path: ./coverage/lcov.info + min_coverage: 45 + token: ${{ github.token }} \ No newline at end of file diff --git a/webapp/package.json b/webapp/package.json index 57967b32a..84cdcbc7c 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -17,7 +17,7 @@ "lint": "eslint --ext .js,.vue .", "locales": "../scripts/translations/missing-keys.sh && ../scripts/translations/sort.sh", "precommit": "yarn lint", - "test": "cross-env NODE_ENV=test jest", + "test": "cross-env NODE_ENV=test jest --coverage", "test:unit:debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --no-cache --runInBand" }, "jest": {