diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000000..a99147c870 --- /dev/null +++ b/.codecov.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index c4a5b290af..7c0e02763d 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -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/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: false + name: frontend + directory: ./frontend/coverage + verbose: true diff --git a/frontend/package.json b/frontend/package.json index 172c82089c..d90e3c7313 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -28,6 +28,7 @@ "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", @@ -35,7 +36,7 @@ "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", diff --git a/package.json b/package.json index 2392d15394..905c65fa93 100644 --- a/package.json +++ b/package.json @@ -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",