istanbul-middleware
istanbul-middleware copied to clipboard
can not getInstrumenter when write my own custom middleware
I write my own custom middleware.As in:
var im = require('istanbul-middleware'),
app.use(function (req, res, next) {
if (isJSRequiringCoverage(req)) {
var file = getFilePath(req), //it's ok
code = readTheCodeFromFile(file),//it's ok
instrumenter = im.getInstrumenter(); //TypeError: im.getInstrumenter is not a function
res.send(instrumenter.instrumentSync(code, file));
//exception handling omitted for brevity
} else {
next();
}
});
the getInstrumenter function is defined in './core.js',I can not use it on im
maybe the getInstrumenter should be exported in handlers.js
Alright,I do it by myself requiring './core.js'
I'm running into the same problem. does this relate to #15 ?