/karma-jasmine-html-reporter-sourcemaps

A Karma plugin. Dynamically displays tests results at debug.html page

Primary LanguageJavaScriptMIT LicenseMIT

karma-jasmine-html-reporter-sourcemaps

Forked from taras42/karma-jasmine-html-reporter This fork brought to you by an issue on jasmine: Feature Request: Sourcemap support Thanks to

This is currently a work in progress.

Reporter that dynamically displays tests results at debug.html page, with source map support. Jasmine 1.3 is not supported.

alt tag

You can also run describe block, or single test.

alt tag

Installation

The easiest way is to keep karma-jasmine-html-reporter-sourcemaps as a devDependency in your package.json.

{
  "devDependencies": {
    "karma": "~0.10",
    "karma-jasmine-html-reporter-sourcemaps": "~0.1"
  }
}

You can simple do it by:

npm install karma-jasmine-html-reporter-sourcemaps --save-dev

Configuration

see example

// karma.conf.js
module.exports = function(config) {
  config.set({
    frameworks: ['jasmine'],
    preprocessors: {
            // add webpack as preprocessor
            'test/*_test.js': ['webpack', 'sourcemap'],
            'test/**/*_test.js': ['webpack', 'sourcemap']
     },
    reporters: ['karma-jasmine-html-sourcemaps']

  });
};

Currently only inline-source-maps are supported.

// webpack.config.js
module.exports = { 
    devtool: 'inline-source-map' 
};

You can pass list of reporters as a CLI argument too:
```bash
karma start --reporters karma-jasmine-html-sourcemaps

Known bugs:

  • Currently only works with inline-source-map
  • When using source-map-loader, it has a bug, where if more then one files gets preprocessed with a source map, you don't get any source maps from the preprocessors (you still get all of the source maps created prior to karma though). ** Fixes:
  1. webpack before calling karma
  2. Only preprocess 1 file for webpack. Utilizing karma-webpack's Alternative usage, works well for this.