isparta-instrumenter-loader

isparta-instrumenter-loader is deprecated. Please use isparta-loader instead

isparta-instrumenter-loader is deprecated. Please use isparta-loader instead
Last updated 4 years ago by colch .
WTFPL · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install isparta-instrumenter-loader 
SYNC missed versions from official npm registry.

:warning: :warning: :exclamation: DEPRECATED :exclamation: :warning: :warning:

This module is unmaintained. Please use deepsweet/isparta-loader

Isparta instrumenter loader for webpack

Instrument JS files with Isparta for subsequent code coverage reporting. Forked from deepsweet/istanbul-instrumenter-loader. Thank you for your work :thumbsup:

Install

$ npm i -S isparta-instrumenter-loader

Usage

Useful to get work together karma-webpack and karma-coverage. For example:

  1. karma-webpack config
  2. karma-coverage config
  3. replace karma-coverage's code instrumenting with isparta-instrumenter-loader's one:
config.set({
    ...
    files: [
      // 'src/**/*.js', << you don't need this anymore
      'test/**/*.js'
    ],
    ...
    preprocessors: {
        // 'src/**/*.js': ['coverage'], << and this too
        'test/**/*.js': [ 'webpack' ]
    },
    reporters: [ 'progress', 'coverage' ],
    coverageReporter: {
        type: 'html',
        dir: 'coverage/'
    },
    ...
    webpack: {
        ...
        module: {
            preLoaders: [ // << add subject as webpack's preloader
                {
                  test: /(\.jsx)|(\.js)$/,
                  // exclude this dirs from coverage
                  exclude: /(test|node_modules|bower_components)\//,
                  loader: 'isparta-instrumenter-loader'
                },
            ],
            // other webpack loaders ...
            loaders: [ ... ],
        },
        ...
    }
});

Documentation: Using loaders.

Passing options to isparta

You can pass config variables to isparta using webpack loader params.

Example (webpack loader config):

{
  test: /(.jsx)|(.js)$/,
  exclude: /(node_modules|bower_components|Spec)/,
  loader: 'isparta-instrumenter',
  query: {
    babel: {
      presets: ['es2015', 'react', 'stage-0']
    }
}

This will specify which presets babel should use at instrumenting stage.

License

WTFPL

Current Tags

  • 1.0.1                                ...           latest (4 years ago)

8 Versions

  • 1.0.1 [deprecated]           ...           4 years ago
  • 1.0.0 [deprecated]           ...           5 years ago
  • 0.2.3 [deprecated]           ...           5 years ago
  • 0.2.2 [deprecated]           ...           5 years ago
  • 0.2.1 [deprecated]           ...           5 years ago
  • 0.2.0 [deprecated]           ...           5 years ago
  • 0.1.1 [deprecated]           ...           6 years ago
  • 0.1.0 [deprecated]           ...           6 years ago

Copyright 2014 - 2017 © taobao.org |