Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Latest commit

 

History

History

example1

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Example 1: one-module TS/JS project

Here you will find an example of project configured to be analyzed with SonarTS.

Scope:

  • Only TS/JS sources

Steps to follow to set up your project the same way

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

Coverage

  • 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 (see analyse.js)
  • Run analysis and find your coverage in SonarQube!
  • This project also uses jest-sonar-reporter to generate test execution data. See configuration in jest.config.js. Report is uploaded by setting sonar.testExecutionReportPaths property (see analyse.js)
  • See documentation about tests and coverage import here