Skip to content

Commit 4158576

Browse files
rpigu-imichaeltintiuc
authored andcommitted
Sonarqube (#10)
* Updated README * Code Coverage for SonarQube * Test coverage for SonarQube
1 parent a02cea2 commit 4158576

File tree

6 files changed

+70
-18
lines changed

6 files changed

+70
-18
lines changed

.circleci/config.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,21 @@ jobs:
2727
- node_modules
2828
key: v1-dependencies-{{ checksum "package.json" }}
2929

30+
- run:
31+
command: |
32+
npm i -D jest-sonar-reporter
33+
3034
# run tests!
3135
- run: npm test && bash <(curl -s https://codecov.io/bash) -t $CODECOV_TOKEN
3236

37+
# SonarQube download, config and scanning
38+
- run: echo "Starting SonarQube scan"
39+
- run: wget https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.2.0.1227-linux.zip
40+
- run: unzip sonar-scanner-cli-3.2.0.1227-linux.zip
41+
- run: echo "sonar.host.url=https://sonarcloud.io" > sonar-scanner-3.2.0.1227-linux/conf/sonar-scanner.properties
42+
- run: echo "sonar.login=$sonarqubekey" >> sonar-project.properties
43+
- run: echo "sonar.organization=$sonarorg" >> sonar-project.properties
44+
- run: sonar-scanner-3.2.0.1227-linux/bin/sonar-scanner
45+
- run: echo "Scan complete, data sent to sonarcloud"
46+
3347

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,4 @@ This project is part of [Modus Labs](https://labs.moduscreate.com).
180180
## Licensing
181181

182182
This project is [MIT licensed](./LICENSE).
183+

jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ module.exports = {
88
'^.+\\.js$': '<rootDir>/node_modules/babel-jest',
99
'.*\\.(vue)$': '<rootDir>/node_modules/jest-vue-preprocessor',
1010
},
11+
"testResultsProcessor": "jest-sonar-reporter"
1112
}

package-lock.json

Lines changed: 33 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"eslint-plugin-promise": "^3.8.0",
5454
"eslint-plugin-vue": "^4.5.0",
5555
"jest": "^23.4.2",
56+
"jest-sonar-reporter": "^2.0.0",
5657
"jest-vue-preprocessor": "^1.4.0",
5758
"rollup": "^0.62.0",
5859
"rollup-plugin-buble": "^0.19.2",
@@ -65,5 +66,15 @@
6566
"vue": "^2.5.16",
6667
"vue-template-compiler": "^2.5.16",
6768
"vue-router": "^3.0.1"
69+
},
70+
"jestSonar": {
71+
"reportPath": "reports",
72+
"reportFile": "test-report.xml",
73+
"indent": 4
74+
},
75+
"dependencies": {
76+
"vue": "^2.5.16",
77+
"vue-router": "^3.0.1",
78+
"vue-template-compiler": "^2.5.16"
6879
}
6980
}

sonar-project.properties

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
sonar.projectKey=ionic_vue
2+
sonar.projectName=ionic_vue
3+
sonar.projectVersion=1.0
4+
sonar.sources=.
5+
sonar.exclusions=coverage/**, sonar-scanner-3.2.0.1227-linux/**, node_modules/js-base64/*.html, node_modules/sprintf-js/demo/*.html, node_modules/terser/tools/*.html, node_modules/uglify-js/tools*.html, node_modules/uri-js/tests/*.html, node_modules/js-base64/test-moment/*.html, node_modules/js-base64/test/*.html, node_modules/uglify-js/tools/*.html
6+
sonar.tests=test
7+
sonar.testExecutionReportPaths=reports/test-report.xml
8+
sonar.test.inclusions=**/*test*/**
9+
sonar.exclusions=**/*test*/**
10+
sonar.javascript.lcov.reportPaths=coverage/lcov.info

0 commit comments

Comments
 (0)