Skip to content

Commit

Permalink
feat: Option Plugins (#948)
Browse files Browse the repository at this point in the history
  • Loading branch information
wzalazar authored and coreyfarrell committed Jan 26, 2019
1 parent 35cd49a commit df2730d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ NYC.prototype._createInstrumenter = function () {
produceSourceMap: this.config.produceSourceMap,
compact: this.config.compact,
preserveComments: this.config.preserveComments,
esModules: this.config.esModules
esModules: this.config.esModules,
plugins: this.config.plugins
})
}

Expand Down
7 changes: 5 additions & 2 deletions lib/instrumenters/istanbul.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ var convertSourceMap = require('convert-source-map')
var mergeSourceMap = require('merge-source-map')

function InstrumenterIstanbul (cwd, options) {
const plugins = options.plugins
const configPlugins = plugins ? { plugins } : {}

var istanbul = InstrumenterIstanbul.istanbul()
var instrumenter = istanbul.createInstrumenter({
var instrumenter = istanbul.createInstrumenter(Object.assign({
autoWrap: true,
coverageVariable: '__coverage__',
embedSource: true,
Expand All @@ -14,7 +17,7 @@ function InstrumenterIstanbul (cwd, options) {
produceSourceMap: options.produceSourceMap,
ignoreClassMethods: options.ignoreClassMethods,
esModules: options.esModules
})
}, configPlugins))

return {
instrumentSync: function (code, filename, sourceMap) {
Expand Down

0 comments on commit df2730d

Please sign in to comment.