node-reporter-sonarqube
v1.0.1
Published
Node test reporter for SonarQube
Downloads
2,373
Maintainers
Readme
node-reporter-sonarqube
A SonarQube/SonarCloud test reporter for the Node.js Test Runner.
Installation
npm i -D node-reporter-sonarqube
Usage
node --test --test-reporter=node-reporter-sonarqube --test-reporter-destination=test-report.xml
Multiple reporters:
node --test --test-reporter=spec --test-reporter-destination=stdout --test-reporter=node-reporter-sonarqube --test-reporter-destination=test-report.xml
GitHub Actions:
# ...
steps:
- name: Check out the code
uses: actions/checkout@v4
- name: Set up Node.js environment
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
- name: Install dependencies
run: npm ci --ignore-scripts
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run postinstall scripts
run: npm rebuild && npm run prepare --if-present
- name: Run tests
run: node --test --test-reporter=spec --test-reporter-destination=stdout --test-reporter=node-reporter-sonarqube --test-reporter-destination=test-report.xml
continue-on-error: true
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@v3
env:
GITHUB_TOKEN: ${{ github.token }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.testExecutionReportPaths=test-report.xml
Workflow used by this repository
See Test reporters for details.