Here you will find an example of project configured to be analyzed with SonarTS.
- Only TS/JS sources
- Install
sonarqube-scanner
npm install -D sonarqube-scanner
- Create script file using
sonarqube-scanner
. This scanner reads the package.json file for project name, description etc. Other analysis properties could be provided as options in your script file.
We recommend to set version of project manually through script file to not depend on the one from package.json
(like this). That way you will be able to profit from correct leak period and focus on quality issues introduced since last release.
- Execute this script
node analyse.js
- In order to send coverage to your SonarQube first generate it. In the case of our example:
npm run test
- Then provide coverage report location as value of
sonar.typescript.lcov.reportPaths
property of your analysis (seeanalyse.js
) - Run analysis and find your coverage in SonarQube!
- This project also uses
jest-sonar-reporter
to generate test execution data. See configuration injest.config.js
. Report is uploaded by settingsonar.testExecutionReportPaths
property (seeanalyse.js
) - See documentation about tests and coverage import here