Skip to content

Commit df2730d

Browse files
wzalazarcoreyfarrell
authored andcommitted
feat: Option Plugins (#948)
1 parent 35cd49a commit df2730d

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ NYC.prototype._createInstrumenter = function () {
140140
produceSourceMap: this.config.produceSourceMap,
141141
compact: this.config.compact,
142142
preserveComments: this.config.preserveComments,
143-
esModules: this.config.esModules
143+
esModules: this.config.esModules,
144+
plugins: this.config.plugins
144145
})
145146
}
146147

lib/instrumenters/istanbul.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ var convertSourceMap = require('convert-source-map')
44
var mergeSourceMap = require('merge-source-map')
55

66
function InstrumenterIstanbul (cwd, options) {
7+
const plugins = options.plugins
8+
const configPlugins = plugins ? { plugins } : {}
9+
710
var istanbul = InstrumenterIstanbul.istanbul()
8-
var instrumenter = istanbul.createInstrumenter({
11+
var instrumenter = istanbul.createInstrumenter(Object.assign({
912
autoWrap: true,
1013
coverageVariable: '__coverage__',
1114
embedSource: true,
@@ -14,7 +17,7 @@ function InstrumenterIstanbul (cwd, options) {
1417
produceSourceMap: options.produceSourceMap,
1518
ignoreClassMethods: options.ignoreClassMethods,
1619
esModules: options.esModules
17-
})
20+
}, configPlugins))
1821

1922
return {
2023
instrumentSync: function (code, filename, sourceMap) {

0 commit comments

Comments
 (0)