istanbul-instrumenter-loader
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -20,3 +20,3 @@ 'use strict'; | ||
that.callback(error, source, instrumenter.lastSourceMap()); | ||
}); | ||
}, sourceMap); | ||
}; |
{ | ||
"name": "istanbul-instrumenter-loader", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Istanbul instrumenter loader for webpack", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -6,4 +6,6 @@ ## Istanbul instrumenter loader for [webpack](https://webpack.github.io/) | ||
Instrument JS files with [istanbul-lib-instrument](https://github.com/istanbuljs/istanbul-lib-instrument) (ES6+ ready using Babel) for subsequent code coverage reporting. | ||
Instrument JS files with [istanbul-lib-instrument](https://github.com/istanbuljs/istanbul-lib-instrument) for subsequent code coverage reporting. | ||
It's not "ES6 ready" yet, see [#33](https://github.com/deepsweet/istanbul-instrumenter-loader/issues/33) for some technical details. | ||
### Install | ||
@@ -46,3 +48,3 @@ | ||
```js | ||
// require all `test/components/**/index.js` | ||
// require all `project/test/src/components/**/index.js` | ||
const testsContext = require.context('./src/components/', true, /index\.js$/); | ||
@@ -52,3 +54,3 @@ | ||
// require all `src/components/**/index.js` | ||
// require all `project/src/components/**/index.js` | ||
const componentsContext = require.context('../src/components/', true, /index\.js$/); | ||
@@ -59,3 +61,3 @@ | ||
This file will be the only entry point for Karma: | ||
This file will be the only entry point for Karma. | ||
@@ -76,3 +78,3 @@ #### karma.conf.js | ||
module: { | ||
postLoaders: [ | ||
preLoaders: [ | ||
// instrument only testing sources with Istanbul | ||
@@ -97,31 +99,5 @@ { | ||
#### 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: | ||
The loader supports all options supported by [istanbul-lib-instrument](https://github.com/istanbuljs/istanbul-lib-instrument/blob/master/api.md#instrumenter). | ||
```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) |
4320
98