Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

karma-sonarqube-execution-reporter

lisrec3.5kMIT0.1.1

A Karma plugin. Report execution results in sonar-unit-tests xml format.

junit, karma-plugin, karma-reporter, sonarqube, sonarqube-execution, sonar, sonar-generic-coverage

readme

karma-sonarqube-execution-reporter

NpmLicense npm NpmVersion

How to install

Run npm install --save-dev karma-sonarqube-unit-reporter in your project directory.
Package is also available on npmjs.org

How to use

  1. Import plugin to karma.conf.js in plugins section:
module.exports = function (config) {
  config.set({
    plugins: [
      require('karma-sonarqube-execution-reporter')
    ]
  })
}
  1. Add plugin configuration to karma.conf.js in config.set section:
module.exports = function (config) {
  config.set({
    sonarQubeExecutionReporter: {
      sonarQubeVersion: 'LATEST',
      testPaths: ['./src/app'],
      testFilePattern: '.spec.ts',
      outputDir: './coverage',
      outputFile: 'ut_report.xml'
    },
  })
}

Avaible options - descriptions

sonarQubeExecutionReporter: {
  sonarQubeVersion: string,
  outputFile: string,
  outputDir: string,
  useBrowserName: boolean,
  testPaths: string[],
  testFilePattern: string,
}

sonarQubeVersion

Pass 'LATEST' or main version of your SonarQube (pattern: '5.x', '6.x', etc).
Default value: 'LATEST'

outputFile

File name for xml report (for example 'execution-report.xml').
Default value: 'ut_report.xml'

outputDir

Relative directory for saving report file. If the directory doesn't exist will be created.
Default value: './' (current directory)

testPath

A single path to the directory, that will be recursively scanned to find tests files.
Default value: './' (current directory)

testPaths

You can pass multiple relative directories instead of a single path, all directories will be recursively scanned for tests files. (Overrides option testPath!)
Default value: ['./'] (current directory only)

testFilePattern

You can pass a regex that will match your test files (for example '(.spec.js)|(.test.js)').
Default value: .spec.(ts|js)

changelog

Changelog

0.0.1 (2016-01-26)

  • Plugin released

0.0.2 (2018-11-22)

Features

  • Updated dependencies
  • Removed 27 vulnerabilities (18 low, 8 high, 1 critical)

0.1.0 (2018-11-22)

Features

  • File path is path to spec file in default
  • Parsing key-words in spec files:
    • describe()
    • describe ()
    • describe.only()
    • describe.only ()

Code changes

  • Extracted nested functions.
  • Added new unit-tests for different describe() key-word combinantions.

0.1.1 (2018-11-22)

Features

  • Removed unused plugin params.
  • Added description to ReadMe for plugin params.