Skip to content

tag based coverage report #7

@inancgumus

Description

@inancgumus

Can't generate valid coverage reports from compiled tag files. For example: With karma lcov reporting, compiled tag file's coverage is not correctly reported.

Reproduce:

Example project:

git clone https://github.com/vitogit/tdd-mocha-chai-riot

Karma Config (updated):

module.exports = function(config) {
  config.set({
    basePath: '',
    frameworks: ['mocha','chai','riot'],
    plugins: [
      'karma-mocha',
      'karma-mocha-reporter',
      'karma-phantomjs-launcher',
      'karma-chai',
      'karma-riot',
      'karma-coverage'
    ],
    files: [
      'node_modules/chai/chai.js',
      'src/**/*.tag',
      'test/**/*.js'
    ],
    preprocessors: {
      '**/*.tag': ['riot', 'coverage'],
      'src/**/*.js': ['coverage']
    },
    coverageReporter: {
      dir: 'coverage/',
      reporters: [
        { type: 'html', subdir: 'report-html' },
        { type: 'text', subdir: '.', file: 'text.txt' },
        { type: 'text-summary', subdir: '.', file: 'text-summary.txt' },
        { type: 'lcovonly', subdir: '.', file: 'lcov.info' }
      ]
    },
    browsers: ['PhantomJS'],
    reporters: ['mocha', 'coverage'],
    failOnEmptyTestSuite: false,
    autoWatch: true
  })
}

How to run?

npm i && npm i karma-coverage --save-dev
karma start
cat coverage/lcov.info

You can also see html based coverage reports inside coverage directory's html coverage reports.

LCOV is incorrect:

screen shot 2016-03-14 at 15 10 26

HTML is correct:

screen shot 2016-03-14 at 15 11 51

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions