You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
uses the following jest command to get code coverage summary as json for the pull request.
17
+
```bash
18
+
npx jest --coverage --coverageReporters="json-summary"
19
+
```
20
+
21
+
Then switches branch to the base branch on which the pull request has been raised and runs the same command again.
22
+
Calculates the diff between the two reports to figure out additions, removals, increase or decrease in code coverage.
23
+
And then posts that diff as a comment on the PR
24
+
25
+
NOTE : The action will work perfectly only for pull requests. Have not been tested with other events or on schedule workflows
26
+
27
+
# Configuration
28
+
29
+
The action assumes jest configuration and jest module already present in the workflow and uses the installed module and the already present config to run the tests.
30
+
31
+
Sample workflow for running this action
32
+
33
+
```
34
+
name: Node.js CI
35
+
36
+
on: pull_request
37
+
38
+
jobs:
39
+
build:
40
+
strategy:
41
+
matrix:
42
+
node-version: [14.x]
43
+
platform: [ubuntu-latest]
44
+
runs-on: ${{ matrix.platform }}
45
+
steps:
46
+
- uses: actions/checkout@v2
47
+
- name: Use Node.js ${{ matrix.node-version }}
48
+
uses: actions/setup-node@v1
49
+
with:
50
+
node-version: ${{ matrix.node-version }}
51
+
- run: npm ci
52
+
- name: TestCoverage
53
+
id: testCovergae
54
+
uses: anuraag016/Jest-Coverage-Diff@master
55
+
with:
56
+
fullCoverageDiff: false // defaults to false, if made true whole coverage report is commented with the diff
0 commit comments