-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow sonar to access the bridge coverage. Apparently codehealth jobs invoke `--if-present test:unit`, not the complete `test` script, so redirect this script to bridge as well. See https://sonarcloud.io/documentation/analysis/coverage/#test-execution https://www.npmjs.com/package/jest-sonar-reporter In order to run coverage only for this codehealth job and to not have that overhead in the normal CI, an extra specialised script is added to the data-bridge package.json. The jest coverage creates absolute paths in lcov.info. However, the tests are run in a docker-container whereas the analysis is performed outside of it and therefore the paths don't match. Since an option to create relative paths in lcov.info is not yet available[0], this uses sed to manually make the paths relative. Also, it seems that collecting coverage is only really useful for unit tests and so the coverage related configuration has been moved there. This patch tries to use the multi module functionality of sonar in order to split up the sonar configuration. It seems promising so far, but whether it really works as intended can probably only be seen after it has been merged into master. [0]: gotwarlost/istanbul#771 [1]: https://docs.sonarqube.org/display/SONARQUBE51/Analyzing+with+SonarQube+Runner#AnalyzingwithSonarQubeRunner-Multi-moduleProject Change-Id: Ic2954e35c7c053eae1ba958751334dc23d2f3f3a
- Loading branch information
Showing
6 changed files
with
22 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
sonar.projectName=Data Bridge | ||
sonar.sources=src | ||
sonar.tests=tests | ||
sonar.javascript.lcov.reportPaths=coverage/lcov.info | ||
sonar.exclusions=dist/**/*,node_modules/**/*,tests/**/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
sonar.tests=client/data-bridge/tests,client/tests,data-access/tests,lib/tests,repo/tests,view/lib/wikibase-tainted-ref/tests,view/tests | ||
sonar.exclusions=client/data-bridge/dist/**/*,client/data-bridge/node_modules/**/*,client/data-bridge/tests/**/*,client/tests/**/*,data-access/tests/**/*,lib/tests/**/*,repo/tests/**/*,view/lib/wikibase-tainted-ref/dist/**/*,view/lib/wikibase-tainted-ref/node_modules/**/*,view/lib/wikibase-tainted-ref/tests/**/*,view/tests/**/* | ||
sonar.tests=client/tests,data-access/tests,lib/tests,repo/tests,view/lib/wikibase-tainted-ref/tests,view/tests | ||
sonar.exclusions=client/data-bridge/**/*,client/tests/**/*,data-access/tests/**/*,lib/tests/**/*,repo/tests/**/*,view/lib/wikibase-tainted-ref/dist/**/*,view/lib/wikibase-tainted-ref/node_modules/**/*,view/lib/wikibase-tainted-ref/tests/**/*,view/tests/**/* | ||
sonar.sources=client,data-access,lib,repo,view | ||
|
||
sonar.modules=bridge | ||
bridge.sonar.projectBaseDir=client/data-bridge |