All Projects → webpack-contrib → Istanbul Instrumenter Loader

webpack-contrib / Istanbul Instrumenter Loader

Licence: mit
Istanbul Instrumenter Loader

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Istanbul Instrumenter Loader

rollup-plugin-istanbul
Seamless integration between Rollup and Istanbul
Stars: ✭ 39 (-85.66%)
Mutual labels:  coverage, karma
angular-cli-skeleton
angular-cli skeleton to quickly start a new project with advanced features and best practices. All features are described in README.md.
Stars: ✭ 32 (-88.24%)
Mutual labels:  coverage, karma
libfuzzer-cov
Get actually nice HTML coverage overview on libfuzzer runs
Stars: ✭ 20 (-92.65%)
Mutual labels:  coverage
vue-popover
Reusable popover component for Vue
Stars: ✭ 22 (-91.91%)
Mutual labels:  karma
css-coverage.js
🎨 Code Coverage for your CSS!
Stars: ✭ 23 (-91.54%)
Mutual labels:  coverage
ts-interface-loader
Webpack support for validating TypeScript definitions at runtime.
Stars: ✭ 19 (-93.01%)
Mutual labels:  webpack-loader
typed-css-modules-loader
💠 Webpack loader for typed-css-modules auto-creation
Stars: ✭ 62 (-77.21%)
Mutual labels:  webpack-loader
tropic
🍍 Test Runner Library
Stars: ✭ 29 (-89.34%)
Mutual labels:  karma
React Proxy Loader
Wraps a react component in a proxy component to enable Code Splitting.
Stars: ✭ 258 (-5.15%)
Mutual labels:  webpack-loader
Cake.Coverlet
Coverlet extensions for Cake Build
Stars: ✭ 39 (-85.66%)
Mutual labels:  coverage
frankencover.it
Code coverage for iOS and OSX.
Stars: ✭ 102 (-62.5%)
Mutual labels:  coverage
web-components-loader
Webpack loader that makes it incredibly easy to import HTML-centric Web Components into your project.
Stars: ✭ 34 (-87.5%)
Mutual labels:  webpack-loader
Webpack-4-boilerplate
🚀 Webpack 4 with ES6+ and SASS,LESS/STYLUS support + dev-server and livereload
Stars: ✭ 55 (-79.78%)
Mutual labels:  webpack-loader
cpytraceafl
CPython bytecode instrumentation and forkserver tools for fuzzing pure python and mixed python/c code using AFL
Stars: ✭ 18 (-93.38%)
Mutual labels:  coverage
gobco
Measure branch coverage of golang tests
Stars: ✭ 36 (-86.76%)
Mutual labels:  coverage
sass-to-string
webpack loader that transform your SCSS file in a javascript string
Stars: ✭ 17 (-93.75%)
Mutual labels:  webpack-loader
exif-loader
Extract EXIF- & IPTC-data from your JPGs during build-time.
Stars: ✭ 14 (-94.85%)
Mutual labels:  webpack-loader
stylos
Webpack plugin to automatically generate and inject CSS utilities to your application
Stars: ✭ 60 (-77.94%)
Mutual labels:  webpack-loader
liftr-tscov
Check the type coverage of any TypeScript project with this easy npm package
Stars: ✭ 28 (-89.71%)
Mutual labels:  coverage
Codecov Node
Global coverage report uploader for Codecov in NodeJS
Stars: ✭ 268 (-1.47%)
Mutual labels:  coverage

npm node deps tests coverage chat

Istanbul Instrumenter Loader

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

Install

npm i -D istanbul-instrumenter-loader

Usage

References

Structure

├─ src
│ |– components
│ | |– bar
│ | │ |─ index.js
│ | |– foo/
│     |– index.js
|– test
| |– src
| | |– components
| | | |– foo
| | | | |– index.js

To create a code coverage report for all components (even for those for which you have no tests yet) you have to require all the 1) sources and 2) tests. Something like it's described in "alternative usage" of karma-webpack

test/index.js

// requires all tests in `project/test/src/components/**/index.js`
const tests = require.context('./src/components/', true, /index\.js$/);

tests.keys().forEach(tests);

// requires all components in `project/src/components/**/index.js`
const components = require.context('../src/components/', true, /index\.js$/);

components.keys().forEach(components);

ℹ️ This file will be the only entry point for karma

karma.conf.js

config.set({
  ...
  files: [
    'test/index.js'
  ],
  preprocessors: {
    'test/index.js': 'webpack'
  },
  webpack: {
    ...
    module: {
      rules: [
        // instrument only testing sources with Istanbul
        {
          test: /\.js$/,
          use: { loader: 'istanbul-instrumenter-loader' },
          include: path.resolve('src/components/')
        }
      ]
    }
    ...
  },
  reporters: [ 'progress', 'coverage-istanbul' ],
  coverageIstanbulReporter: {
    reports: [ 'text-summary' ],
    fixWebpackSourcePaths: true
  }
  ...
});

with Babel

You must run the instrumentation as a post step

webpack.config.js

{
  test: /\.js$|\.jsx$/,
  use: {
    loader: 'istanbul-instrumenter-loader',
    options: { esModules: true }
  },
  enforce: 'post',
  exclude: /node_modules|\.spec\.js$/,
}

Options

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

Name Type Default Description
debug {Boolean} false Turn on debugging mode
compact {Boolean} true Generate compact code
autoWrap {Boolean} false Set to true to allow return statements outside of functions
esModules {Boolean} false Set to true to instrument ES2015 Modules
coverageVariable {String} __coverage__ Name of global coverage variable
preserveComments {Boolean} false Preserve comments in output
produceSourceMap {Boolean} false Set to true to produce a source map for the instrumented code
sourceMapUrlCallback {Function} null A 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

webpack.config.js

{
  test: /\.js$/,
  use: {
    loader: 'istanbul-instrumenter-loader',
    options: {...options}
  }
}

Maintainers

Kir Belevich Juho Vepsäläinen Joshua Wiens Michael Ciniawsky Matt Lewis
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].