Base coverage collection skipped with base coverage file provided
See original GitHub issueDescribe a bug
The base coverage collection is still beeing skipped although a base coverage file is provided by the configuration. That means no coverage diff is reported on the PR comment. My Bugfix from #239 was supposed to fix this issue but it does not seem to work. I would look into it myself, but I do not have the time right now. If this is not picked up until next week I will come back to it myself.
Expected behavior
Base coverage is collected from the provided coverage file and coverage diff percentage is shown in the PR comment. Also the branch should remain unchanged. We know it was working before when branches where switched, but that should be unnecessary and can cause other errors (see #236)
Details
Action version: 2.0.4 OS, where your action is running (windows, linux): linux
action.yml file
name: Test, build & Docker push
on: pull_request
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
# We need full history for commitlint.
with:
fetch-depth: 0
- name: Get coverage cache
uses: actions/cache@v2
with:
key: base-coverage-${{ github.ref }}
restore-keys: base-coverage-${{ github.base_ref }}
path: ./coverage/base-report.json
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: '16.14.0'
cache: 'yarn'
- name: Install project dependencies
run: yarn --frozen-lockfile
- name: Run linting
if: ${{ false }}
run: yarn lint
- name: Run tests
run: yarn test --runInBand --coverage --coverageThreshold '{}' --testLocationInResults --json --outputFile=./coverage/report.json
# make sure the file exists
- run: cat ./coverage/base-report.json
- uses: artiomtr/jest-coverage-report-action@v2.0.4
# It will annotate failing tests as well, so we can run it always.
if: always()
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
package-manager: yarn
coverage-file: ./coverage/report.json
base-coverage-file: ./coverage/base-report.json
annotations: all
skip-step: all
Screenshots
Additional context
Log output
Run artiomtr/jest-coverage-report-action@v2.0.4
with:
github-token: ***
package-manager: yarn
coverage-file: ./coverage/report.json
base-coverage-file: ./coverage/base-report.json
annotations: all
skip-step: all
test-script: npx jest
icons: emoji
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: ./coverage/report.json
INPUT_BASE-COVERAGE-FILE: ./coverage/base-report.json
Running using node v16.14.0
Begin initialization stage...
Initialization stage ended
Begin stages.parsethreshold...
[...] (unrelated esbuild warning about jest.config.ts)
stages.parseThreshold 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: coverage/report.json
Collecting coverage ended
Begin parsing coverage...
Parsing coverage ended
Head coverage collection ended
Begin switching to base branch...
Switching to base branch skipped
Switching to base branch ended
Begin base coverage collection...
Base coverage collection skipped
Base coverage collection ended
Begin switching back to original branch...
Switching back to original branch skipped
Switching back to original branch ended
Begin stages.checkthreshold...
stages.checkThreshold ended
Begin generating report...
Generating report ended
Begin report publish...
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 ended
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (6 by maintainers)
Top GitHub Comments
I tried
artiomtr/jest-coverage-report-action@v2.0.5
and it works as expected. Thanks!@Raigen Thanks for the clarification, make sense now, thank you =)