Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opt-out of comparison doesn't work well #376

Open
earonesty opened this issue Jun 3, 2023 · 4 comments
Open

opt-out of comparison doesn't work well #376

earonesty opened this issue Jun 3, 2023 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@earonesty
Copy link

earonesty commented Jun 3, 2023

the action still checks out the master branch, even if the base-coverage-file is specified

it is unclear where the base-coverage-file should live. i had jest produce a "report.json" and the code still looks in "master/report.json"

i think it would be better for there to be a simple option

with:
comparision: false

or something.

@earonesty earonesty added the bug Something isn't working label Jun 3, 2023
@boryscastor
Copy link

Same here! I am trying to implement just a coverage on the current branch, without comparison (I also don't need it for the sack of time) - still fetches the main branch.

@ChrisMBarr
Copy link

Yes please, I also don't need it to compare anything. I just want it to show me the coverage from the current PR. I thought that was the whole point of this project anyway. Branch comparison seems like a huge extra step that should not be on by default.

For my company, we pay for GitHub enterprise, and anything that makes a build step take longer or store more artifacts actually can cost us real money. I'd love to have a way to simply run jest tests and report the results. That's all.

@earonesty
Copy link
Author

i pip installed "diff-cover" https://pypi.org/project/diff-cover/. using that for now

@ChrisMBarr
Copy link

I ended up using https://github.com/MishaKav/jest-coverage-comment/

You run the tests separately, it generates report files, and then you point this action at the files. It also can show reports from multiple projects, useful for a monorepo

name: Pull Request Sanity Check

on:
  pull_request:
    paths-ignore: ['.vscode/**', 'README.md', '.*']

permissions:
  contents: write # allows actions to read & write files generated by the build steps, etc.
  pull-requests: write # allows actions to modify aspects of the PR, like adding comments, labels, etc.

jobs:
  pr-sanity-check:
    concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
    runs-on: ubuntu-latest
    steps:
      - name: 🧪 Unit Test Runner
        working-directory: server-nest
        run: npx jest --coverage --coverageReporters=text --coverageReporters=json-summary --reporters=jest-junit --reporters=github-actions

      - name: 🧪 Unit Test Reporter
        uses: MishaKav/jest-coverage-comment@main
        with: #we can have this report on code coverage in multiple projects
          title: Code Coverage Report
          multiple-files: |
            NestJS Server, ./server-nest/coverage/coverage-summary.json
          multiple-junitxml-files: |
            NestJS Server, ./server-nest/junit.xml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants