1.0.0 • Published 3 years ago

@ngageoint/opensphere-coverage-loader v1.0.0

Weekly downloads
32
License
MIT
Repository
github
Last release
3 years ago

OpenSphere Code Coverage Loader

Instrument JS files with istanbul-lib-instrument for subsequent code coverage reporting.

This project is forked from istanbul-instrumenter-loader to provide additional maintenance in support of OpenSphere.

Install

npm i -D istanbul-instrumenter-loader

Usage

Add the loader to the webpack config:

module: {
  rules: [
    {
      test: /\.js$/,
      use: {
        loader: '@ngageoint/opensphere-coverage-loader',
        options: {esModules: true}
      },
      include: path.resolve('src')
    }
  ]
}

Then configure karma-coverage-istanbul-reporter as your test coverage reporter.

Options

The loader supports all options supported by istanbul-lib-instrument

NameTypeDefaultDescription
debug{Boolean}falseTurn on debugging mode
compact{Boolean}trueGenerate compact code
autoWrap{Boolean}falseSet to true to allow return statements outside of functions
esModules{Boolean}falseSet to true to instrument ES2015 Modules
coverageVariable{String}__coverage__Name of global coverage variable
preserveComments{Boolean}falsePreserve comments in output
produceSourceMap{Boolean}falseSet to true to produce a source map for the instrumented code
sourceMapUrlCallback{Function}nullA callback function that is called when a source map URL is found in the original code. This function is called with the source filename and the source map URL