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

Getting No coverage for file path when looking inside coverage path #22

Open
KumarNellore opened this issue Oct 15, 2015 · 0 comments
Open

Comments

@KumarNellore
Copy link

I'm getting No coverage for file path []. In command prompt i can see message

Could not find file [d:\protractordemo\protractor-demo\public\angular.min.js], ignoring
Could not find file [d:\protractordemo\protractor-demo\public\calc.js], ignoring

I"m testing with istanbul-middleware with https://github.com/juliemr/protractor-demo.

I created index.js file as shown in Istanbul-middleware example. And in expressserver.js file modifed content
as below.

var util = require('util');
var path = require('path'),
express = require('express'),
url = require('url'),
publicDir = path.resolve(__dirname, '..', 'public'),
coverage = require('istanbul-middleware'),
bodyParser = require('body-parser');

function matcher(req) {
    var parsed = url.parse(req.url);
    return parsed.pathname && parsed.pathname.match(/\.js$/) && !parsed.pathname.match(/jquery/);
}

module.exports = {
    start: function (port, needCover) {
        var app = express();
        if (needCover) {
            console.log('Turn on coverage reporting at /coverage');
            app.use('/coverage', coverage.createHandler({ verbose: true, resetOnGet: true }));
            app.use(coverage.createClientHandler(publicDir, { matcher: matcher }));
        }

        app.use(bodyParser.urlencoded({ extended: true }));
        app.use(bodyParser.json());

        app.set('view engine', 'hbs');
        app.engine('hbs', require('hbs').__express);
        app.use(express['static'](publicDir));
        app.use(express.static(__dirname));
        app.listen(port);
        console.log('Server running at http://localhost:'+port);
    }
};

and Started application from command prompt with command "node index.js"

I'm not able to get coverage.

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

1 participant