Skip to content
A Karma plugin. Unit tests execution report for SonarQube/Generic Coverage Plugin
Branch: master
Clone or download
Latest commit bcc312b Aug 20, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Cleanup Aug 7, 2018
.gitignore ignore *.iml Feb 20, 2016
.travis.yml initial commit Jan 26, 2016 initial commit Jan 26, 2016
LICENSE Initial commit Jan 26, 2016 Cleanup Aug 20, 2018
gruntfile.js jasmine tests running in grunt Apr 28, 2017
index.js change testPath to testPaths so multiple test file locations can be s… Mar 5, 2018
package.json release 0.0.18 Aug 7, 2018
sonar-unit-tests.xsd initial commit Jan 26, 2016


NpmLicense npm NpmVersion


Clear feedback. Just if you appreciate my efforts!


This solution is based on .


How to get

Available on

How to use


'use strict';

var path = require('path');
var conf = require('./gulp/conf');

var _ = require('lodash');
var wiredep = require('wiredep');

var pathSrcHtml = [
  path.join(conf.paths.src, '/**/*.html'),
  path.join(conf.paths.src_test, '/**/*.html')

function listFiles() {
  var wiredepOptions = _.extend({}, conf.wiredep, {
    dependencies: true,
    devDependencies: true

  return wiredep(wiredepOptions).js
      path.join(conf.paths.src, '/app/**/*.module.js'),
      path.join(conf.paths.src, '/app/**/*.js'),
      path.join(conf.paths.src, '/**/*.spec.js'),
      path.join(conf.paths.src, '/**/*.mock.js'),
      path.join(conf.paths.src_test, '/app/**/*.module.js'),
      path.join(conf.paths.src_test, '/app/**/*.js'),
      path.join(conf.paths.src_test, '/**/*.spec.js'),
      path.join(conf.paths.src_test, '/**/*.mock.js')

module.exports = function(config) {

  var configuration = {
    files: listFiles(),

    singleRun: true,
    colors:    false,

    autoWatch: false,

    ngHtml2JsPreprocessor: {
      stripPrefix: conf.paths.src + '/',

    logLevel: 'WARN',

    frameworks: ['jasmine', 'angular-filesort'],

    angularFilesort: {
      whitelist: [path.join(conf.paths.src, '/**/!(*.html|*.spec|*.mock).js'), path.join(conf.paths.src_test, '/**/!(*.html|*.spec|*.mock).js')]

    browsers: ['PhantomJS'],

    sonarQubeUnitReporter: {
      sonarQubeVersion: 'LATEST',
      outputFile: 'reports/ut_report.xml',
      useBrowserName: false

    plugins: [

    coverageReporter: {
      type : 'lcov',
      dir : 'reports',
      subdir : 'coverage'

    reporters: ['progress', 'sonarqubeUnit', 'coverage'],
    preprocessors: {
      'src/**/*.js':   ['coverage'],
      'test/**/*.js':   ['coverage']


By default, the description of the jasmine tests used as the path attribute in the generated xml. If this is not the case with your tests, you can use the following options to automagically find the right path values. It is the recommended way to use this plugin but to be backward compatible it is not enabled by default.

sonarQubeUnitReporter: {
      sonarQubeVersion: 'LATEST',
      outputFile: 'reports/ut_report.xml',
      overrideTestDescription: true,
      testPaths: ['./test', './moreTests'],
      testFilePattern: '.spec.js',
      useBrowserName: false
Prerequisites for development
  • npm install
  • npm build
You can’t perform that action at this time.