Skip to content

Commit 3971cd5

Browse files
author
Anuraag Puri
authored
Readme update for new features
1 parent c7c7d94 commit 3971cd5

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

+16
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,20 @@ NOTE : The action will work perfectly only for pull requests. Have not been test
2828

2929
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.
3030

31+
**NEW:**
32+
33+
- The action now supports custom run command, for custom use cases, using the variable runCommand, you can now pass your own command to run. Following is an example where we want to collect coverage from only few files out of all the code and want to use custom options such as `forceExit` & `detectOpenHandles`.
34+
```bash
35+
runCommand: "npx jest --collectCoverageFrom='[\"src/**/*.{js,jsx,ts,tsx}\"]' --coverage --collectCoverage=true --coverageDirectory='./' --coverageReporters='json-summary' --forceExit --detectOpenHandles test/.*test.*"
36+
```
37+
**NOTE:** If using custom command, `--coverage --collectCoverage=true --coverageDirectory='./' --coverageReporters='json-summary'`, these options are necessary for the action to work properly. These options tells jest to collect the coverage in json summary format and put the final output in the root folder. Since these are necessary, will make the action add them automatically in the next version.
38+
39+
- Do you want to fail the workflow if the commited code decreases the percentage below a tolerable level? Do you to start a healthy culture of writing test cases?
40+
The action now also supports failing the run if percentage diff is more than a specified delta value for any file, you can specify the delta value using the variable delta
41+
```bash
42+
delta: 1 // the action will fail if any of the percentage dip is more than 1% for any changed file
43+
```
44+
3145
Sample workflow for running this action
3246
3347
```
@@ -54,4 +68,6 @@ jobs:
5468
uses: anuraag016/Jest-Coverage-Diff@master
5569
with:
5670
fullCoverageDiff: false // defaults to false, if made true whole coverage report is commented with the diff
71+
runCommand: "npx jest --collectCoverageFrom='[\"src/**/*.{js,jsx,ts,tsx}\"]' --coverage --collectCoverage=true --coverageDirectory='./' --coverageReporters='json-summary' --forceExit --detectOpenHandles test/.*test.*"
72+
delta: 0.5
5773
```

0 commit comments

Comments
 (0)