jest-coverage-report-action
jest-coverage-report-action copied to clipboard
Prevent origin install when coverageFilePath is provided
Why is this action doing a package manager install when a coverageFilePath is provided as input? If all information is there, why we need to force install?
https://github.com/ArtiomTr/jest-coverage-report-action/blob/08d11f0e6441f75e59498356304658f8e55c6760/src/stages/getCoverage.ts#L24
Hello @diestrin 👋,
This action should not install dependencies when coverageFilePath is set. The line of code that you've attached to your comment shows that - if coverageFilePath is true (not an empty string or undefined) then installation step should be skipped. This is a full fragment:
https://github.com/ArtiomTr/jest-coverage-report-action/blob/08d11f0e6441f75e59498356304658f8e55c6760/src/stages/getCoverage.ts#L23-L28
However, if you see that action installs dependencies ignoring this option - it is not an intended behavior, it is a bug. To make sure that installation step is not skipped, please run latest v2.0-rc.6 version and send me a screenshot of your action's console.
You are right, for some reason when I was testing, it was still attempting to install on the remote checkout. I couldn't figure out why tho. Problem is, I moved into a custom actions runner, and now the process is getting stuck after checkout the base branch.
Run artiomtr/[email protected]
with:
github-token: ***
skip-step: all
coverage-file: output/reports/coverage-final.json
base-coverage-file: output/reports/coverage-final.json
package-manager: yarn
test-script: npx jest
icons: emoji
annotations: all
Run $GITHUB_ACTION_PATH/run.sh
$GITHUB_ACTION_PATH/run.sh
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
INPUT_GITHUB-TOKEN: ***
INPUT_TEST-SCRIPT: npx jest
INPUT_THRESHOLD:
INPUT_WORKING-DIRECTORY:
INPUT_ICONS: emoji
INPUT_ANNOTATIONS: all
INPUT_PACKAGE-MANAGER: yarn
INPUT_SKIP-STEP: all
INPUT_CUSTOM-TITLE:
INPUT_COVERAGE-FILE: output/reports/coverage-final.json
INPUT_BASE-COVERAGE-FILE: output/reports/coverage-final.json
Running using node v14.18.1
/usr/bin/git fetch --all --depth=1
Fetching origin
From https://github.com/***
* [new branch] main -> origin/main
/usr/bin/git checkout -f main
Previous HEAD position was e8d6975 Merge 38d8c56ed9cd67d4df68d15c8e3b885c8c6d4085 into 5671de0131f57e4e8d433d6a23247e19d89d074d
Switched to a new branch 'main'
Branch 'main' set up to track remote branch 'main' from 'origin'.
Error: Jest coverage report action failed
Error: Process completed with exit code 1.
Is there any debug env flag I can send to get more logs out of what's going on?
You can use latest v2.0-rc.6 version, where each stage that runs / skips / fails is indicated in the action's console.

Thanks, after updating to the rc.6 version, this is what I got.
Run artiomtr/[email protected]
with:
github-token: ***
skip-step: all
coverage-file: output/reports/coverage-final.json
base-coverage-file: output/reports/coverage-final.json
package-manager: yarn
test-script: npx jest
icons: emoji
annotations: all
Run $GITHUB_ACTION_PATH/run.sh
$GITHUB_ACTION_PATH/run.sh
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
INPUT_GITHUB-TOKEN: ***
INPUT_TEST-SCRIPT: npx jest
INPUT_THRESHOLD:
INPUT_WORKING-DIRECTORY:
INPUT_ICONS: emoji
INPUT_ANNOTATIONS: all
INPUT_PACKAGE-MANAGER: yarn
INPUT_SKIP-STEP: all
INPUT_CUSTOM-TITLE:
INPUT_COVERAGE-FILE: output/reports/coverage-final.json
INPUT_BASE-COVERAGE-FILE: output/reports/coverage-final.json
Running using node v14.18.2
Begin initialization stage...
Initialization stage ended
Begin head coverage collection...
Begin installing dependencies...
Installing dependencies skipped
Installing dependencies ended
Begin running tests...
Running tests skipped
Running tests ended
Begin collecting coverage...
Loading code coverage from file: output/reports/coverage-final.json
Collecting coverage ended
Begin parsing coverage...
Parsing coverage ended
Head coverage collection ended
Begin switching to base branch...
/usr/bin/git fetch --all --depth=1
Fetching origin
From https://github.com/...
* [new branch] main -> origin/main
/usr/bin/git checkout -f main
Previous HEAD position was 67d3de1 Merge a9d2d6438c2689ade5c919ee9679e0c81faead34 into f3684d96a03ad406c12c42b67036045f90dcdb82
Switched to a new branch 'main'
Branch 'main' set up to track remote branch 'main' from 'origin'.
Switching to base branch ended
Begin base coverage collection...
Begin installing dependencies...
Installing dependencies skipped
Installing dependencies ended
Begin running tests...
Running tests skipped
Running tests ended
Begin collecting coverage...
Loading code coverage from file: output/reports/coverage-final.json
Collecting coverage ended
Begin parsing coverage...
Parsing coverage ended
Base coverage collection ended
Begin generating report...
Generating report failed
-> Error: TypeError: Cannot convert undefined or null to object
Generating report ended
Begin report publish...
Report publish skipped
Report publish ended
Begin failed tests' annotations publication...
Failed tests' annotations publication skipped
Failed tests' annotations publication ended
Begin coverage annotations publication...
Coverage annotations publication failed
-> Error: TypeError: Cannot convert undefined or null to object
Coverage annotations publication ended
-> Error: Jest coverage report action failed
-> Error: Process completed with exit code 1.
Here is the file output/reports/coverage-final.json I'm providing for both coverage-file and base-coverage-file
Running into the same issue here. Posted my details below. Any idea what might be causing this @ArtiomTr ?
Expected behavior
The report should be generated.
Details
- Action version:
ArtiomTr/[email protected] - OS, where your action is running (windows, linux):
ubuntu-latest - Jest version: 27.2.1
- action.yml file
- name: Install dependencies run: yarn --frozen-lockfile - name: Run unit tests run: yarn test:unit - name: Run coverage report if: ${{ github.event_name == 'pull_request' }} uses: ArtiomTr/[email protected] with: github-token: ${{ secrets.GITHUB_TOKEN }} annotations: none coverage-file: ./test-results/coverage-final.json base-coverage-file: ./test-results/main/coverage-final.json threshold: 80 - Screenshots

Additional context
Here is also my report I'm passing through ./test-results/coverage-final.json
I also tried the report from the testResultsProcessor result-processor-report.json.zip
Hello @bteng22 👋,
Sorry for the late response. Could you please try one more time with v2 version? I've added a stack logging for errors, so it would be easier to determine at which line/function the action is failing. Thank you in advance.
This is what I am seeing here, if it helps!
Error: TypeError: Cannot convert undefined or null to object
TypeError: Cannot convert undefined or null to object
at Function.entries (<anonymous>)
at cp (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.3/dist/index.js:28:3134)
at _m (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.3/dist/index.js:28:3537)
at /home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.3/dist/index.js:51:1460
at je (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.3/dist/index.js:50:162)
at xw (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.3/dist/index.js:51:1414)
stages.checkThreshold ended
Begin generating report...
Generating report failed
Error: TypeError: Cannot convert undefined or null to object
TypeError: Cannot convert undefined or null to object
at Function.values (<anonymous>)
at P1 (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.3/dist/index.js:28:4923)
at Qn (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.3/dist/index.js:28:5065)
at Gm (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.3/dist/index.js:36:25)
at Xm (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.3/dist/index.js:48:261)
at /home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.3/dist/index.js:51:1541
at je (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.3/dist/index.js:50:162)
at xw (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.3/dist/index.js:51:1503)
Generating report ended
Begin report publish...
Report publish skipped
Report publish ended
Begin failed tests' annotations publication...
Failed tests' annotations publication skipped
Failed tests' annotations publication ended
Begin coverage annotations publication...
Coverage annotations publication failed
Error: TypeError: Cannot convert undefined or null to object
TypeError: Cannot convert undefined or null to object
at Function.entries (<anonymous>)
at Hu (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.3/dist/index.js:23:127[67](https://github.com/Invisible-Goods/mint-songs-client/runs/5098022955?check_suite_focus=true#step:6:67))
at /home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.3/dist/index.js:51:2054
at je (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.3/dist/index.js:50:162)
at xw (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0.3/dist/index.js:51:1[95](https://github.com/Invisible-Goods/mint-songs-client/runs/5098022955?check_suite_focus=true#step:6:95)6)
Coverage annotations publication ended
Error: Jest coverage report action failed
Error: Process completed with exit code 1.
Actions config:
- name: Jest coverage report
if: always()
uses: ArtiomTr/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
coverage-file: ./coverage/coverage-summary.json
base-coverage-file: ./coverage/coverage-main.json
skip-step: install
@Kadajett,
Thank you for the information provided. I need some time to figure out what is causing this error.
Any updates on this issue? I'm getting the same error
Error: TypeError: Cannot convert undefined or null to object
- name: Run Tests
run: yarn test
- name: Collect Coverage
uses: ArtiomTr/jest-coverage-report-action@v2
with:
skip-step: install
coverage-file: ./coverage/coverage-final.json
base-coverage-file: ./coverage/coverage-final.json
package-manager: yarn
github-token: ****
Hello @jamesBennett :wave:,
I've described possible solutions here https://github.com/ArtiomTr/jest-coverage-report-action/issues/268#issuecomment-1148504250.
Also, I'm closing this issue because the initial problem is resolved.