@@ -33,28 +33,24 @@ jobs:
3333 - name : Install dependencies
3434 run : npm ci
3535
36- - name : Jest Coverage Report
36+ - name : Run unit tests with coverage
37+ run : npm test -- --coverage --testMatch="**/test/unit/**/*.spec.ts" --coverageReporters=json-summary --coverageReporters=text --coverageReporters=lcov
38+
39+ - name : Jest Coverage Report (PR Comment)
3740 if : github.event_name == 'pull_request'
3841 uses : artiomtr/jest-coverage-report-action@v2
3942 with :
4043 github-token : ${{ secrets.GITHUB_TOKEN }}
41- test-script : npm test -- --coverage --testMatch="**/test/unit/**/*.spec.ts"
44+ coverage-file : ./reports/contentstack-delivery/coverage/coverage-summary.json
45+ base-coverage-file : ./reports/contentstack-delivery/coverage/coverage-summary.json
4246 threshold : 95
4347 working-directory : ./
44- package-manager : npm
45- annotations : failed-tests
46- coverage-file : ./coverage/coverage-summary.json
47- base-coverage-file : ./coverage/coverage-summary.json
48- skip-step : install
49-
50- - name : Run unit tests with coverage (for push events)
51- if : github.event_name == 'push'
52- run : npm test -- --coverage --testMatch="**/test/unit/**/*.spec.ts" --coverageReporters=json-summary --coverageReporters=text
48+ skip-step : all
5349
5450 - name : Verify coverage threshold
5551 run : |
5652 COVERAGE=$(node -pe "
57- const c = JSON.parse(require('fs').readFileSync('coverage/coverage-summary.json')).total;
53+ const c = JSON.parse(require('fs').readFileSync('reports/contentstack-delivery/ coverage/coverage-summary.json')).total;
5854 const threshold = 95;
5955 const metrics = ['statements', 'branches', 'functions', 'lines'];
6056 const failed = metrics.filter(m => c[m].pct < threshold);
7167 with :
7268 name : coverage-report
7369 path : |
74- coverage/
75- reports/
70+ reports/contentstack-delivery/coverage
7671 retention-days : 30
7772
0 commit comments