NEW:
- 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
.
runCommand: "npx jest --collectCoverageFrom='[\"src/**/*.{js,jsx,ts,tsx}\"]' --coverage --collectCoverage=true --coverageDirectory='./' --coverageReporters='json-summary' --forceExit --detectOpenHandles test/.*test.*"
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.
- 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?
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
delta: 1 // the action will fail if any of the percentage dip is more than 1% for any changed file