Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Commit

Permalink
Upgrade to istanbul-lib-instrument
Browse files Browse the repository at this point in the history
  • Loading branch information
Micha Reiser committed Sep 6, 2016
1 parent 8d8d1f3 commit 1d0356b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
16 changes: 9 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
'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
autoWrap: 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 }, defaultOptions, userOptions)
);

if (this.cacheable) {
this.cacheable();
}

return instrumenter.instrumentSync(source, this.resourcePath);
var that = this;
return instrumenter.instrument(source, this.resourcePath, function (error, source) {
that.callback(error, source, instrumenter.lastSourceMap());
});
};
13 changes: 10 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@
"name": "istanbul-instrumenter-loader",
"version": "0.2.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",
"repository": "deepsweet/istanbul-instrumenter-loader",
"author": "Kir Belevich <[email protected]> (https://github.com/deepsweet)",
"main": "index.js",
"files": [ "index.js" ],
"files": [
"index.js"
],
"dependencies": {
"istanbul": "0.x.x",
"istanbul-lib-instrument": "^1.1.1",
"loader-utils": "0.x.x",
"object-assign": "4.x.x"
},
Expand Down

0 comments on commit 1d0356b

Please sign in to comment.