Skip to content

Commit

Permalink
add scripts for coverage reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
christianvogt committed May 10, 2024
1 parent baa33fc commit 0796f53
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
22 changes: 22 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
codecov:
require_ci_to_pass: true

coverage:
precision: 2
round: down
range: "70...100"
status:
project: true
patch: true
# project:
# frontend:
# target: auto
# threshold: 1%
# patch:
# default:
# target: 70%

comment:
layout: "reach,diff,flags,files,footer"
behavior: default
require_changes: false
11 changes: 9 additions & 2 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ jobs:
- name: Check for uncomitted changes
run: |
git diff --exit-code
- name: Test
- name: Test backend & test frontend with code coverage
if: ${{ success() }}
run: npm run test
run: npm run test:backend && npm run test:frontend:coverage
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
name: frontend
directory: ./frontend/coverage
3 changes: 2 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@
"start:dev": "webpack serve --hot --color --config ./config/webpack.dev.js",
"start:dev:ext": "EXT_CLUSTER=true npm run start:dev",
"test": "run-s test:lint test:type-check test:unit test:cypress-ci",
"test:coverage": "run-s test:lint test:type-check test:jest:coverage test:cypress-ci:coverage coverage:merge",
"test:fix": "eslint --ext .js,.ts,.jsx,.tsx ./src --fix",
"test:lint": "eslint --max-warnings 0 --ext .js,.ts,.jsx,.tsx ./src",
"test:type-check": "tsc --noEmit",
"test:jest": "jest",
"test:jest:coverage": "rimraf jest-coverage && jest --coverage",
"test:unit": "npm run test:jest",
"test:cypress-ci": "npx concurrently -P -k -s first \"npm run cypress:server:build && npm run cypress:server\" \"npx wait-on tcp:127.0.0.1:9001 && npm run cypress:run:mock -- {@}\" -- ",
"test:cypress-ci:coverage": "npx concurrently -P -k -s first \"npm run cypress:server:build:coverage && npm run cypress:server\" \"npx wait-on tcp:127.0.0.1:9001 && npm run cypress:run:mock:coverage -- {@}\" -- ",
"test:cypress-ci:coverage": "npx concurrently -P -k -s first \"npm run cypress:server:build:coverage && npm run cypress:server\" \"npx wait-on tcp:127.0.0.1:9001 && npm run cypress:run:mock:coverage\"",
"coverage:merge": "rimraf coverage && istanbul-merge --out coverage/coverage-final.json jest-coverage/coverage-final.json src/__tests__/cypress/coverage/coverage-final.json && nyc report --reporter html -t coverage --report-dir coverage/report && nyc report --reporter json-summary -t coverage --report-dir coverage",
"cypress:open": "cypress open --project src/__tests__/cypress",
"cypress:run": "cypress run -b chrome --project src/__tests__/cypress",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"test": "run-s test:backend test:frontend",
"test:backend": "cd ./backend && npm run test",
"test:frontend": "cd ./frontend && npm run test",
"test:frontend:coverage": "cd ./frontend && npm run test:coverage",
"test:cypress-ci": "cd ./frontend && npm run test:cypress-ci -- ",
"test:unit": "cd ./frontend && npm run test:unit",
"test:fix": "run-s test:fix-backend test:fix-frontend",
Expand Down

0 comments on commit 0796f53

Please sign in to comment.