Skip to content

Commit

Permalink
run coverage with PR and upload to codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
christianvogt committed May 9, 2024
1 parent 6f9e993 commit a019be3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ 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]
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
fail_ci_if_error: true
name: frontend
files: ./frontend/coverage/coverage-final.json
5 changes: 3 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,16 @@
"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 -- {@}\" -- ",
"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 --reporter text -t coverage --report-dir 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",
"cypress:open:mock": "MOCK=1 WS_PORT=9002 npm run cypress:open -- ",
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 a019be3

Please sign in to comment.