node-reporter-sonarqube
A SonarQube/SonarCloud test reporter for the Node.js Test Runner.
Installation
npm i -D node-reporter-sonarqubeUsage
node --test --test-reporter=node-reporter-sonarqube --test-reporter-destination=test-report.xmlMultiple reporters:
node --test --test-reporter=spec --test-reporter-destination=stdout --test-reporter=node-reporter-sonarqube --test-reporter-destination=test-report.xmlGitHub 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.xmlWorkflow used by this repository
See Test reporters for details.
 sjinks
sjinks