Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Output tests to browser with Karma

I am using Karma to test my project and can see tests passing an failing in the console window, however, how do I get these to show in the browser? The browser only has a green bar (even though a test is failing) with

Karma v0.10.2 - connected

Written in it.

I have tried addong singleRun :false to the karma.config.js file.

The config file looks like this:

module.exports = function (config) {
    config.set({
        basePath: '../',

        files: [
            'app/lib/angular/angular.js',
            'app/lib/angular/angular-*.js',
            'test/lib/angular/angular-mocks.js',
            'app/js/**/*.js',
            'test/unit/**/*.js'
        ],

        autoWatch: true,
        singleRun: false,
        frameworks: ['jasmine'],

        browsers: ['Chrome'],

        plugins: [
            'karma-junit-reporter',
            'karma-chrome-launcher',
            'karma-firefox-launcher',
            'karma-jasmine'
        ],

        junitReporter: {
            outputFile: 'test_out/unit.xml',
            suite: 'unit'
        }

    })
}
like image 334
BanksySan Avatar asked Sep 11 '13 12:09

BanksySan


1 Answers

matthias-schuetz wrote a plugin that claims to produce html test output.

https://npmjs.org/package/karma-htmlfile-reporter

Along with the instructions on the plugin page I had to include a reference to the plugin in the Karma config -

plugins: [
'karma-htmlfile-reporter'
]
like image 85
daddywoodland Avatar answered Nov 10 '22 20:11

daddywoodland