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

sum-coverage reporting incorrect total coverage #518

Open
finn-orsini opened this issue Aug 14, 2023 · 0 comments
Open

sum-coverage reporting incorrect total coverage #518

finn-orsini opened this issue Aug 14, 2023 · 0 comments

Comments

@finn-orsini
Copy link

Description

The output of sum-coverage (following calls to format-coverage) is incorrectly reporting total coverage stats.
Behavior appears in CI (github actions, ubuntu-22.04) and locally (mac osx 13.3).

Steps to Reproduce

Create the following files (which locally were generated from format-coverage of lcov files):

coverage-cypress.json

{
  "ci_service": {
    "branch": "finn_orsini_example",
    "build_identifier": "",
    "build_url": "",
    "commit_sha": "84fe3d6c048cf3a2233ca91109c59c89fbb462f9",
    "committed_at": 1692022071,
    "name": ""
  },
  "environment": {
    "gem_version": "3.4.10",
    "package_version": "",
    "pwd": "/Users/forsini/code/repo",
    "prefix": "/Users/forsini/code/repo",
    "rails_root": "",
    "reporter_version": "latest",
    "simplecov_root": ""
  },
  "git": {
    "branch": "finn_orsini_example",
    "head": "84fe3d6c048cf3a2233ca91109c59c89fbb462f9",
    "committed_at": 1692022071
  },
  "covered_percent": 44.6081319976429,
  "covered_strength": 0,
  "line_counts": {
    "missed": 940,
    "covered": 757,
    "total": 1697
  },
  "source_files": [
    {
      "blob_id": "07b162a33528600bc64ef8831f7526bec214ce4a",
      "coverage": "[]",
      "covered_percent": 0,
      "covered_strength": 0,
      "line_counts": {
        "missed": 0,
        "covered": 0,
        "total": 0
      },
      "name": "src/app/example.js"
    }
  ],
  "repo_token": ""
}

coverage-jest.json

{
  "ci_service": {
    "branch": "finn_orsini_example",
    "build_identifier": "",
    "build_url": "",
    "commit_sha": "84fe3d6c048cf3a2233ca91109c59c89fbb462f9",
    "committed_at": 1692022071,
    "name": ""
  },
  "environment": {
    "gem_version": "3.4.10",
    "package_version": "",
    "pwd": "/Users/forsini/code/repo",
    "prefix": "/Users/forsini/code/repo",
    "rails_root": "",
    "reporter_version": "latest",
    "simplecov_root": ""
  },
  "git": {
    "branch": "finn_orsini_example",
    "head": "84fe3d6c048cf3a2233ca91109c59c89fbb462f9",
    "committed_at": 1692022071
  },
  "covered_percent": 95.39007092198581,
  "covered_strength": 0,
  "line_counts": {
    "missed": 13,
    "covered": 269,
    "total": 282
  },
  "source_files": [
    {
      "blob_id": "07b162a33528600bc64ef8831f7526bec214ce4a",
      "coverage": "[null,null,null,null,null,null,null,null,null,null,null,8,8,null,null,null,null,9,null,8,8,null,null,null,null,8,null,null,null,null,null,8,null,1,1,null,null,8,null,8,8,null,null,null,null,null,8,null,8,null,null,8,null,null,6,6,null,6,3,null,null,null,null,null,null,null,null,3,null,null,null,null,null,null,null,null,null,3,null,null,null,null,null,null,null,null,null,null,8,null,0,null,null,null,null,null,null,null,0]",
      "covered_percent": 91.66666666666666,
      "covered_strength": 5.916666666666667,
      "line_counts": {
        "missed": 2,
        "covered": 22,
        "total": 24
      },
      "name": "src/app/example.js"
    }
  ],
  "repo_token": ""
}

Run the sum coverage command, i.e. ./cc-test-reporter sum-coverage coverage-cypress.json coverage-jest.json -p 2 -o coverage-total.json .
View the total coverage report, which incorrectly reports that the example.js file has no coverage:

{
  "ci_service": {
    "branch": "finn_orsini_example",
    "build_identifier": "",
    "build_url": "",
    "commit_sha": "84fe3d6c048cf3a2233ca91109c59c89fbb462f9",
    "committed_at": 1692022071,
    "name": ""
  },
  "environment": {
    "gem_version": "3.4.10",
    "package_version": "",
    "pwd": "/Users/forsini/code/repo",
    "prefix": "/Users/forsini/code/repo",
    "rails_root": "",
    "reporter_version": "latest",
    "simplecov_root": ""
  },
  "git": {
    "branch": "finn_orsini_example",
    "head": "84fe3d6c048cf3a2233ca91109c59c89fbb462f9",
    "committed_at": 1692022071
  },
  "covered_percent": 44.6081319976429,
  "covered_strength": 0,
  "line_counts": {
    "missed": 940,
    "covered": 757,
    "total": 1697
  },
  "source_files": [
    {
      "blob_id": "07b162a33528600bc64ef8831f7526bec214ce4a",
      "coverage": "[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null]",
      "covered_percent": 0,
      "covered_strength": 0,
      "line_counts": {
        "missed": 0,
        "covered": 0,
        "total": 0
      },
      "name": "src/app/example.js"
    }
  ],
  "repo_token": ""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant