Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can not getInstrumenter when write my own custom middleware #27

Open
flyHe opened this issue Apr 7, 2016 · 3 comments
Open

can not getInstrumenter when write my own custom middleware #27

flyHe opened this issue Apr 7, 2016 · 3 comments

Comments

@flyHe
Copy link

flyHe commented Apr 7, 2016

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

@flyHe
Copy link
Author

flyHe commented Apr 7, 2016

maybe the getInstrumenter should be exported in handlers.js

@flyHe
Copy link
Author

flyHe commented Apr 25, 2016

Alright,I do it by myself requiring './core.js'

@lenntt
Copy link

lenntt commented Apr 3, 2017

I'm running into the same problem. does this relate to #15 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants