Gathering detailed insights and metrics for grunt-karma-sonar
Gathering detailed insights and metrics for grunt-karma-sonar
Gathering detailed insights and metrics for grunt-karma-sonar
Gathering detailed insights and metrics for grunt-karma-sonar
npm install grunt-karma-sonar
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
11 Stars
154 Commits
14 Forks
4 Watching
2 Branches
5 Contributors
Updated on 19 Feb 2022
JavaScript (66.18%)
HTML (25.7%)
CSS (8.12%)
Cumulative downloads
Total Downloads
Last day
-66.7%
8
Compared to previous day
Last week
-23.3%
89
Compared to previous week
Last month
30.6%
401
Compared to previous month
Last year
-70.1%
4,623
Compared to previous year
Grunt plugin for integrating karma and protractor reports with sonar.
Currently the following frameworks are supported for both unit and integration testing:
To enable integration test result and coverage in Sonar, you need to install the following plugin sonar-javascript-integrationtests
This plugin requires Grunt ~0.4.5
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
1npm install grunt-karma-sonar --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
1grunt.loadNpmTasks('grunt-karma-sonar');
In your project's Gruntfile, add a section named karmaSonar
to the data object passed into grunt.initConfig()
.
1grunt.initConfig({
2 karmaSonar: {
3 options: {
4 // Task-specific options go here.
5 },
6 your_target: {
7 // Target-specific file lists and/or options go here.
8 },
9 },
10})
Type: String
Default: 'reuseReports'
Should be the sonar.property dynamicAnalysis
Type: String
Default: 'UTF-8'
Should be the sonar.property sourceEncoding
Type: String
Default: 'js'
Should be the sonar.property language (Starting with SonarQube 4.2, multi-language projects are supported. To enable this, set the value to null)
Type: String
Default: 'true'
Should be the sonar.property scmDisabled
Type: String
Default: '.tmp/sonar/'
Should be the location where the karmaSonar plugin will put it's temporary files.
Type: Array
Default: []
Should be the indicator for performing a dry run.
Type: Boolean
Default: false
Type: Object
Should be the list of key(sonar key
) value pairs.
1runnerProperties: { 2 'sonar.links.homepage': 'https://github.com/mdasberg/grunt-karma-sonar', 3 'sonar.branch': 'master' 4}
Should be a list of sonar properties to exclude
Type: String
Default: 'http://localhost:9000'
Should be the sonar.property host.url
Type: String
Default: 'jdbc:h2:tcp://localhost:9092/sonar'
Should be the sonar.property jdbc.url
Type: String
Default: 'sonar'
Should be the sonar.property jdbc.username
Type: String
Default: 'sonar'
Should be the sonar.property jdbc.password
Type: String
Default: 'admin'
Should be the sonar.property login
Type: String
Default: 'admin'
Should be the sonar.property password
Type: Boolean
Default: 'false'
If true sonar-runner debug logging will be turned on.
Type: Object
,
Mandatory: true
Should be the project information for sonar
Type: String
Mandatory: true`
Should be the project key for sonar
Type: String
Mandatory: true`
Should be the project name for sonar
Type: String
Should be the project version for sonar
Type: Array
Should be the paths that contain the code, tests and results
Type: String
Default: '.'
Should be the current working directory that contain the source, tests and results folders are located
Type: String
Should be the directory containing the sources within the cwd.
Type: String
Should be the directory containing the tests within the cwd.
Type: Object
Should be the object containing the reports.
Type: String
or Object
ie: {src: '...', framework: 'jasmine'} (Supported frameworks are: cucumber, jasmine/jasmine2(default))
Should be the location of the karma-junit-reporter report within the cwd.
Type: String
Should be the glob for the lcov.info files within the cwd.
Type: String
or Object
ie: {src: '...', framework: 'jasmine'} (Supported frameworks are: cucumber, jasmine/jasmine2(default))
Should be the location of the protractor report within the cwd.
Type: String
Should be the glob for the integration test lcov.info files within the cwd.
1grunt.initConfig({
2 karmaSonar: {
3 options: {
4
5 },
6 your_target: {
7 project: {
8 key: 'grunt-sonar',
9 name: 'Grunt sonar plugin',
10 version: '0.2.13'
11 },
12 paths: [
13 {
14 cwd: '...', // the current working directory'
15 src: '...', // the source directory within the cwd
16 test: '...', // the test directory within the cwd
17 reports: {
18 unit: '../path/result.xml', // the result file within the cwd
19 coverage: '../path/**/lcov.info', // the glob for lcov files'
20 itCoverage: '../path/**/lcov.info' // the glob for integration lcov files'
21 }
22 },
23 {
24 cwd: '...', // the current working directory'
25 src: '...', // the source directory within the cwd
26 test: '...', // the test directory within the cwd
27 reports: {
28 unit: '../path/result.xml', // the result file within the cwd
29 coverage: '../path/**/lcov.info', // the glob for lcov files'
30 itCoverage: '../path/**/lcov.info' // the glob for integration lcov files'
31 }
32 ],
33 exclusions: []
34 }
35 }
36})
In this example, custom options are used to do something else with whatever else. So if the testing
file has the content Testing
and the 123
file had the content 1 2 3
, the generated result in this case would be Testing: 1 2 3 !!!
1grunt.initConfig({
2 karmaSonar: {
3 options: {
4 defaultOutputDir: '.tmp/sonar/custom_options/',
5 instance: {
6 hostUrl : 'http://localhost:20001',
7 jdbcUrl : 'jdbc:h2:tcp://localhost:20003/sonar',
8 login: 'admin',
9 password: 'admin'
10 }
11 },
12 your_target: {
13 project: {
14 key: 'grunt-sonar',
15 name: 'Grunt sonar plugin',
16 version: '0.2.13'
17 },
18 paths: [...],
19 exclusions: []
20 }
21 }
22})
By default, this package will download sonar-runner from https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.codehaus.sonar.runner&a=sonar-runner-dist&v=LATEST&p=zip
,
but only when sonar-runner is not available on the path.
If for some reason sonatype is down, or the Great Firewall is blocking sonatype, you may need to use
a download mirror url. To set a mirror, set npm config property sonarrunner_cdnurl
.
Default is ``.
1npm install grunt-karma-sonar --sonarrunner_cdnurl=http://some-mirror.org/path/to/downloads
Or add property into your .npmrc
file (https://www.npmjs.org/doc/files/npmrc.html)
sonarrunner_cdnurl=http://some-mirror.org/path/to/downloads
Another option is to use PATH variable SONARRUNNER_CDNURL
.
1SONARRUNNER_CDNURL=http://some-mirror.org/path/to/downloads npm install grunt-karma-sonar
Note: It will try to find sonar-runner-dist.zip
in the cdn url.
If for some reason sonatype is down, or the Great Firewall is blocking sonatype, you may need to use
a download mirror directory. To set a mirror, set npm config property sonarrunner_cdndir
.
Default is ``.
1npm install grunt-karma-sonar --sonarrunner_cdndir=/some/path/downloads
Or add property into your .npmrc
file (https://www.npmjs.org/doc/files/npmrc.html)
sonarrunner_cdndir=/some/path/downloads
Another option is to use PATH variable SONARRUNNER_CDNDIR
.
1SONARRUNNER_CDNDIR=/some/path/downloads npm install grunt-karma-sonar
Note: It can be the case that there are multiple versions available at the download mirror. If this is the case the latest version will be used.
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
(Nothing yet)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
no SAST tool detected
Details
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More