mardi 8 décembre 2015

How to get Karma html reporter working in karma conf?

How to get Karma html reporter working in karma conf?

To run my unit tests I type: "npm run test" and the tests run fine in git bash. But I want to see them in the reporter.html file.

I've made a reporter.html file next to the karma conf file in the root directory. The reporter.html file has nothing in it.

I think the reporter.html file gets populated when I run npm run tests and the reporter html page shows up. But this doesn't happen.

This is my karma conf:

  module.exports = function(config) {
    config.set({

      basePath: '',

      frameworks: ['jasmine'],

      files: [
        {pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: true},
        {pattern: 'node_modules/angular2/bundles/angular2.js', included: true, watched: true},
        {pattern: 'node_modules/angular2/bundles/testing.js', included: true, watched: true},
        {pattern: 'node_modules/angular2/bundles/router.dev.js', included: true, watched: true},
        {pattern: 'node_modules/angular2/bundles/http.js', included: true, watched: true},      
        {pattern: 'src/firebase/firebase.js', included: true, watched: true},  

        {pattern: 'karma-test-shim.js', included: true, watched: true},

        {pattern: 'src/**/*.js', included: false, watched: true},
        {pattern: 'src/**/*.html', included: false, watched: true},
        {pattern: 'src/**/*.css', included: false, watched: true},
        {pattern: 'src/**/*.ts', included: false, watched: false},
        {pattern: 'src/**/*.js.map', included: false, watched: false}
      ],

      proxies: {
        "/app/": "/base/src/app/"
      },

      reporters: ['progress', 'html'],

      //This doesnt seem to work or show up????
      htmlReporter: {
        outputFile: 'reporter.html'              
      },

      port: 9877,
      colors: true,
      logLevel: config.LOG_INFO,
      autoWatch: true,
      browsers: ['Chrome'],
      singleRun: false
    })
  }

Aucun commentaire:

Enregistrer un commentaire