File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212jobs :
1313 test-and-coverage :
1414 runs-on : ubuntu-latest
15+ permissions :
16+ pull-requests : write # to add comments to the PRs
17+ contents : read
18+
1519 steps :
1620 - uses : actions/checkout@v4
1721
@@ -23,15 +27,24 @@ jobs:
2327 - name : Install dependencies
2428 run : npm ci
2529 working-directory : frontend
26-
30+
31+ # 1. RUN ONLY TESTS ON PUSH
32+ - name : Run frontend tests
33+ if : github.event_name == 'push'
34+ run : npm test
35+ working-directory : frontend
36+
37+ # 2. RUN COVERAGE ON PRs
2738 - name : Run jest with coverage
28- run : npm run coverage
39+ if : github.event_name == 'pull_request'
40+ run : npx jest --coverage --coverageReporters json-summary
2941 working-directory : frontend
3042
31- - name : Save coverage Artifact for the Workflow
43+ # 3. POST COMMENT ON PR
44+ - name : Jest Coverage Comment
3245 if : >
3346 github.event_name == 'pull_request'
34- uses : actions/upload-artifact@v4
47+ uses : MishaKav/jest-coverage-comment@main
3548 with :
36- name : jest- coverage
37- path : frontend/coverage
49+ coverage-summary-path : ./frontend/ coverage/coverage-summary.json
50+ title : Frontend Coverage Report
You can’t perform that action at this time.
0 commit comments