https://github.com/sjinks/node-reporter-sonarqube
Node.js test reporter for SonarQube / SonarCloud
https://github.com/sjinks/node-reporter-sonarqube
node node-test-reporter nodejs sonarqube sonarqube-reports test-reporter
Last synced: about 1 month ago
JSON representation
Node.js test reporter for SonarQube / SonarCloud
- Host: GitHub
- URL: https://github.com/sjinks/node-reporter-sonarqube
- Owner: sjinks
- License: mit
- Created: 2024-09-01T05:09:05.000Z (9 months ago)
- Default Branch: master
- Last Pushed: 2025-03-03T06:38:26.000Z (3 months ago)
- Last Synced: 2025-03-05T05:02:22.409Z (3 months ago)
- Topics: node, node-test-reporter, nodejs, sonarqube, sonarqube-reports, test-reporter
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/node-reporter-sonarqube
- Size: 490 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# node-reporter-sonarqube
[](https://github.com/sjinks/node-reporter-sonarqube/actions/workflows/build.yml)
[](https://sonarcloud.io/summary/new_code?id=sjinks_node-reporter-sonarqube)A [SonarQube](https://www.sonarsource.com/products/sonarqube/)/[SonarCloud](https://www.sonarsource.com/products/sonarcloud/) [test reporter](https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/test-coverage/generic-test-data/#generic-test-execution) for the Node.js [Test Runner](https://nodejs.org/api/test.html).
## Installation
```bash
npm i -D node-reporter-sonarqube
```## Usage
```bash
node --test --test-reporter=node-reporter-sonarqube --test-reporter-destination=test-report.xml
```Multiple reporters:
```bash
node --test --test-reporter=spec --test-reporter-destination=stdout --test-reporter=node-reporter-sonarqube --test-reporter-destination=test-report.xml
```GitHub Actions:
```yaml
# ...
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](.github/workflows/sonarscan.yml)
See [Test reporters](https://nodejs.org/api/test.html#test-reporters) for details.