Skip to content

Coverage services ​

Run tests and generate a report in a format your service accepts before uploading it. These steps assume outputDir is ./coverage-reports; lcov: true also writes lcov.info. For sharded tests, decide whether to merge in MCR or let your service merge the uploads.

Codecov ​

codecov Use the built-in codecov report to generate codecov.json.

js
const coverageOptions = {
    outputDir: './coverage-reports',
    reports: [
        ['codecov']
    ]
};

GitHub Actions upload step:

yml
- name: Codecov
  uses: codecov/codecov-action@v7
  with:
    token: ${{ secrets.CODECOV_TOKEN }}
    files: ./coverage-reports/codecov.json
    disable_search: true
    fail_ci_if_error: true

disable_search limits the upload to the named file, and fail_ci_if_error makes upload errors fail CI. To avoid storing an upload token, see the Codecov Action instructions for OIDC.

Codacy ​

Codacy Generate an LCOV report:

js
const coverageOptions = {
    outputDir: './coverage-reports',
    lcov: true
};

GitHub Actions upload step:

yml
- name: Codacy Coverage Reporter
  uses: codacy/codacy-coverage-reporter-action@v1
  with:
    project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
    coverage-reports: ./coverage-reports/lcov.info

Coveralls ​

Coverage Status Generate an LCOV report:

js
const coverageOptions = {
    outputDir: './coverage-reports',
    lcov: true
};

GitHub Actions upload step:

yml
- name: Coveralls
  uses: coverallsapp/github-action@v2
  with:
    file: ./coverage-reports/lcov.info
    format: lcov

If each shard uploads separately, follow the Coveralls Action instructions for parallel and send parallel-finished after all shards complete.

SonarQube Cloud ​

Coverage Coverage requires CI-based analysis. Disable automatic analysis if it is enabled. Set fetch-depth: 0 in your actions/checkout step and generate lcov.info before scanning. Replace the organization, project key, and directories with your own. See the official LCOV configuration guide.

yml
- name: Analyze with SonarQube Cloud
  uses: SonarSource/sonarqube-scan-action@v8
  env:
    SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
  with:
    projectBaseDir: ./
    args: >
      -Dsonar.organization=your-organization
      -Dsonar.projectKey=your-project-key
      -Dsonar.javascript.lcov.reportPaths=coverage-reports/lcov.info
      -Dsonar.sources=lib
      -Dsonar.tests=test