{"maintainers":[{"name":"anonymous","email":"zak@ubiquits.com"}],"keywords":["webpack","loader","istanbul","coverage"],"dist-tags":{"latest":"0.2.0"},"author":{"name":"Kir Belevich","email":"kir@soulshine.in","url":"https://github.com/deepsweet"},"description":"Istanbul instrumenter loader for webpack","readme":"## Istanbul instrumenter loader for [webpack](https://webpack.github.io/)\n\n[![npm](http://img.shields.io/npm/v/istanbul-instrumenter-loader.svg?style=flat-square)](https://www.npmjs.org/package/istanbul-instrumenter-loader)\n[![deps](http://img.shields.io/david/deepsweet/istanbul-instrumenter-loader.svg?style=flat-square)](https://david-dm.org/deepsweet/istanbul-instrumenter-loader#info=dependencies)\n\nInstrument JS files with [Istanbul](https://github.com/gotwarlost/istanbul) for subsequent code coverage reporting.\n\nUsing Babel to transpile ES6/ES7? Use [isparta-loader](https://github.com/deepsweet/isparta-loader) to coverage your original code.\n\n### Install\n\n```sh\n$ npm i -D istanbul-instrumenter-loader\n```\n\n### Setup\n\n#### References\n\n* [Using loaders](https://webpack.github.io/docs/using-loaders.html)\n* [karma-webpack](https://github.com/webpack/karma-webpack#karma-webpack)\n* [karma-coverage](https://github.com/karma-runner/karma-coverage#configuration)\n\n#### Project structure\n\nLet's say you have the following:\n\n```\n├── src/\n│   └── components/\n│       ├── bar/\n│       │   └── index.js\n│       └── foo/\n│           └── index.js\n└── test/\n    └── src/\n        └── components/\n            └── foo/\n                └── index.js\n```\n\nTo 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](https://github.com/webpack/karma-webpack#alternative-usage):\n\n#### test/index.js\n\n```js\n// require all `test/components/**/index.js`\nconst testsContext = require.context('./src/components/', true, /index\\.js$/);\n\ntestsContext.keys().forEach(testsContext);\n\n// require all `src/components/**/index.js`\nconst componentsContext = require.context('../src/components/', true, /index\\.js$/);\n\ncomponentsContext.keys().forEach(componentsContext);\n```\n\nThis file will be the only entry point for Karma:\n\n#### karma.conf.js\n\n```js\nconfig.set({\n    …\n    files: [\n        'test/index.js'\n    ],\n    preprocessors: {\n        'test/index.js': 'webpack'\n    },\n    webpack: {\n        …\n        module: {\n            preLoaders: [\n                // instrument only testing sources with Istanbul\n                {\n                    test: /\\.js$/,\n                    include: path.resolve('src/components/'),\n                    loader: 'istanbul-instrumenter'\n                }\n            ]\n        }\n        …\n    },\n    reporters: [ 'progress', 'coverage' ],\n    coverageReporter: {\n        type: 'text'\n    },\n    …\n});\n```\n\n### License\n[WTFPL](http://www.wtfpl.net/wp-content/uploads/2012/12/wtfpl-strip.jpg)\n","repository":{"type":"git","url":"git+https://github.com/zakhenry/istanbul-instrumenter-loader.git"},"bugs":{"url":"https://github.com/zakhenry/istanbul-instrumenter-loader/issues"},"license":"WTFPL","versions":{"0.2.0":{"name":"sourcemap-istanbul-instrumenter-loader","version":"0.2.0","description":"Istanbul instrumenter loader for webpack","keywords":["webpack","loader","istanbul","coverage"],"homepage":"https://github.com/zakhenry/istanbul-instrumenter-loader","repository":{"type":"git","url":"git+https://github.com/zakhenry/istanbul-instrumenter-loader.git"},"author":{"name":"Kir Belevich","email":"kir@soulshine.in","url":"https://github.com/deepsweet"},"main":"index.js","files":["index.js"],"dependencies":{"istanbul":"0.x.x","loader-utils":"0.x.x","object-assign":"4.x.x"},"engines":{"node":">=0.10.0"},"license":"WTFPL","gitHead":"a8fe5dee861b1fc88e1a0d2c3a99cc49c6cac516","bugs":{"url":"https://github.com/zakhenry/istanbul-instrumenter-loader/issues"},"_id":"sourcemap-istanbul-instrumenter-loader@0.2.0","scripts":{},"_shasum":"8fd72e8abd16ded58918a7474db5bb3d0dbbcacd","_from":".","_npmVersion":"3.9.0","_nodeVersion":"5.4.1","_npmUser":{"name":"anonymous","email":"zak@ubiquits.com"},"dist":{"shasum":"8fd72e8abd16ded58918a7474db5bb3d0dbbcacd","tarball":"http://repository.ncinga.com/nexus/content/repositories/npm-js-registry/sourcemap-istanbul-instrumenter-loader/-/sourcemap-istanbul-instrumenter-loader-0.2.0.tgz","integrity":"sha512-cPlqsE1rDeDHmjXjoCsxFuMP83wdLM8HwZpL0pkjGywXJIusCRWo1YZQaTsaqGvwYb9cE8iM4P6vgHKwC+FeXw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCRvS0ODaGUda/ciF0ly4BvbNnlQdue7ZtTBfYcq/0rbwIhAKQy/AMruHVBPRyHQVfvumvZNH3VkEAv/4Z25E/SnQ8b"}]},"maintainers":[{"name":"anonymous","email":"zak@ubiquits.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/sourcemap-istanbul-instrumenter-loader-0.2.0.tgz_1463759069614_0.45551982591859996"}}},"name":"sourcemap-istanbul-instrumenter-loader","time":{"modified":"2022-06-26T22:24:11.772Z","created":"2016-05-20T15:44:31.839Z","0.2.0":"2016-05-20T15:44:31.839Z"},"readmeFilename":"README.md","homepage":"https://github.com/zakhenry/istanbul-instrumenter-loader"}