Istanbul plugin for Webpack

Istanbul code coverage loader for Webpack

TypeScript example

This example demonstrates using coverage-istanbul-loader with transpiled code. The webpack.config.js file uses ts-loader to transpile the TypeScript to JavaScript. The key thing to notice here is that the output bundle and source map both map back to the original TypeScript source code.

Note: Webpack processes loaders in reverse order, so ts-loader must come after coverage-istanbul-loader in the config file.

Structure

Folder/File Description
webpack.config.js The webpack config file. It uses ts-loader to transpile the TypeScript to JavaScript.
src folder The original TypeScript source code.
dist/main.js The bundled webpack output. It’s intentionally not minified to make it easier to see what’s going on.
dist/main.js.map The output sourcemap, which maps back to the original TypeScript source code files.