typescript - Github Actions Sonar Scanner lcov.info içindeki dosya yollarını çözemiyor
Öncelikle, benimle benzer çözümlenmiş sorunların olduğunun farkındayım, ancak her olası cevabı 50 kez denedim, bu yüzden vakamın benzersiz olabileceğini düşünüyorum.
Mocha testlerimin nyc ile oluşturduğu lcov.info kapsama verilerini SonarQube örneme yüklemeye çalışıyorum. Ne yazık ki, ne denersem deneyeyim, sonar-scanner lcov dosyasında belirtilen dosyaları bulamıyor gibi görünüyor:
WARN: Could not resolve 7 file paths in [/github/workspace/coverage/lcov.info]
WARN: First unresolved path: config/file:config/config.ts
İşte tarayıcının bazı ilgili hata ayıklama günlükleri: https://pastebin.com/n8hhzMG4
yarn test: nyc --reporter=lcovonly --reporter=text-summary mocha -r ts-node/register 'tests/run.test.ts'
SonarScanner iş akışı dosyası:
name: Build
on:
push:
branches: [ master ]
pull_request:
types: [opened, synchronize, reopened]
branches: [ master ]
jobs:
sonarqube:
name: sonarqube
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install dependencies
run: yarn
- name: Run Tests
run: yarn test
## This is one of the suggested fixes.
## Im removing the dir paths that were tested for and make them relative paths.
- name: Fix coverage report
run: sed -i "s+/home/runner/work/rest-api/rest-api/++g" coverage/lcov.info
- name: Run SonarQube Scan
uses: sonarsource/sonarqube-scan-action@master
with:
## used to debug sonarqube-scan-action
args: >
-Dsonar.verbose=true
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
sonar-project.properties
sonar.language=ts
sonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar.sources=.
sonar.tests=tests/
sonar.coverage.exclusions=tests/**
sonar.test.inclusions=tests/**
sonar.projectKey=<PROJECT-KEY>