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

"Convenience aliases" breaking unit tests, code coverage #991

Closed
GeoffreyPlitt opened this issue Sep 7, 2016 · 3 comments
Closed

"Convenience aliases" breaking unit tests, code coverage #991

GeoffreyPlitt opened this issue Sep 7, 2016 · 3 comments

Comments

@GeoffreyPlitt
Copy link

I'm using Istanbul to run code coverage (and tests) on some code. We use socket.io-client in our codebase.

The tests are failing with the following problem, caused by some weird "Convenience aliases" in the socket.io-client codebase around line 5235. Here's the code around socket.io.js:5235:

    // Native constructor aliases.
    var Number = context["Number"] || root["Number"],
        String = context["String"] || root["String"],
        Object = context["Object"] || root["Object"],
        Date = context["Date"] || root["Date"],
        SyntaxError = context["SyntaxError"] || root["SyntaxError"],
        TypeError = context["TypeError"] || root["TypeError"],
        Math = context["Math"] || root["Math"],
        nativeJSON = context["JSON"] || root["JSON"];

And here's the error I'm getting:

$ npm test

> mocha src/**/*.spec.js

/Users/giro/stardust-app/node_modules/socket.io-client/socket.io.js:5251
    var objectProto = Object.prototype,
                            ^

TypeError: Cannot read property 'prototype' of undefined
    at runInContext (/Users/giro/stardust-app/node_modules/socket.io-client/socket.io.js:5251:29)
    at Object.<anonymous> (/Users/giro/stardust-app/node_modules/socket.io-client/socket.io.js:6070:5)
    at Object.<anonymous> (/Users/giro/stardust-app/node_modules/socket.io-client/socket.io.js:6103:4)

Please advise, thanks.

@GeoffreyPlitt
Copy link
Author

Any update?

@hilkeheremans
Copy link

hilkeheremans commented Sep 13, 2016

Related to #2381, please check there

socketio/socket.io#2381

@GeoffreyPlitt
Copy link
Author

Thanks!

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