You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

istanbul-instrumenter-loader

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.0 to 1.0.0

18

index.js
'use strict';
var istanbul = require('istanbul');
var istanbulLibInstrument = require('istanbul-lib-instrument');
var loaderUtils = require('loader-utils');
var assign = require('object-assign');
var defaultOptions = {
embedSource: true,
noAutoWrap: true
};
module.exports = function(source) {
module.exports = function(source, sourceMap) {
var userOptions = loaderUtils.parseQuery(this.query);
var instrumenter = new istanbul.Instrumenter(
assign({}, defaultOptions, userOptions)
var instrumenter = istanbulLibInstrument.createInstrumenter(
assign({ produceSourceMap: this.sourceMap }, userOptions)
);

@@ -22,3 +17,6 @@

return instrumenter.instrumentSync(source, this.resourcePath);
var that = this;
return instrumenter.instrument(source, this.resourcePath, function (error, source) {
that.callback(error, source, instrumenter.lastSourceMap());
});
};
{
"name": "istanbul-instrumenter-loader",
"version": "0.2.0",
"version": "1.0.0",
"description": "Istanbul instrumenter loader for webpack",
"keywords": [ "webpack", "loader", "istanbul", "coverage" ],
"keywords": [
"webpack",
"loader",
"istanbul",
"coverage"
],
"homepage": "https://github.com/deepsweet/istanbul-instrumenter-loader",

@@ -10,12 +15,14 @@ "repository": "deepsweet/istanbul-instrumenter-loader",

"main": "index.js",
"files": [ "index.js" ],
"files": [
"index.js"
],
"dependencies": {
"istanbul": "0.x.x",
"loader-utils": "0.x.x",
"object-assign": "4.x.x"
"istanbul-lib-instrument": "^1.1.3",
"loader-utils": "^0.2.16",
"object-assign": "^4.1.0"
},
"engines": {
"node": ">=0.10.0"
"node": ">=0.12.0"
},
"license": "WTFPL"
}

@@ -6,6 +6,4 @@ ## Istanbul instrumenter loader for [webpack](https://webpack.github.io/)

Instrument JS files with [Istanbul](https://github.com/gotwarlost/istanbul) for subsequent code coverage reporting.
Instrument JS files with [istanbul-lib-instrument](https://github.com/istanbuljs/istanbul-lib-instrument) (ES6+ ready using Babel) for subsequent code coverage reporting.
Using Babel to transpile ES6/ES7? Use [isparta-loader](https://github.com/deepsweet/isparta-loader) to coverage your original code.
### Install

@@ -75,3 +73,3 @@

module: {
preLoaders: [
postLoaders: [
// instrument only testing sources with Istanbul

@@ -95,3 +93,32 @@ {

#### Options
The loader supports all options supported by [istanbul-lib-instrument](https://github.com/istanbuljs/istanbul-lib-instrument/blob/37a0087e68729dae46989c3687272d154938fa9e/src/instrumenter.js#L28-L37). The defaults are:
```js
{
coverageVariable: '__coverage__',
preserveComments: false,
compact: true,
esModules: false,
autoWrap: false,
produceSourceMap: false,
sourceMapUrlCallback: null,
debug: false
}
```
E.g. if a project is using ES6 modules then `esModules` option must be set to `true`:
```js
{
test: /\.js$/,
include: path.resolve('src/components/'),
loader: 'istanbul-instrumenter',
query: {
esModules: true
}
}
```
### License
[WTFPL](http://www.wtfpl.net/wp-content/uploads/2012/12/wtfpl-strip.jpg)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc