JavaScript / TypeScript test coverage
SonarQube supports the reporting of test coverage information as part of the analysis of your JS/TS project.
Adjust your setup
Adding coverage to your build process
- name: Install dependencies
run: yarn
- name: Test and coverage
run: yarn jest --coveragename: Build
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
sonarqube:
name: sonarqube
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install dependencies
run: yarn
- name: Test and coverage
run: yarn jest --coverage
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}Adding the coverage analysis parameter
Coverage parameters can be set in multiple places
Same parameter for JavaScript and TypeScript
Related pages
Last updated
Was this helpful?

