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

undefined hasOwnProperty? #73

Closed
nivthefox opened this issue Aug 17, 2015 · 4 comments
Closed

undefined hasOwnProperty? #73

nivthefox opened this issue Aug 17, 2015 · 4 comments

Comments

@nivthefox
Copy link

I'm a little baffled by this one, because hasOwnProperty is a part of node core. Using node-v0.12.7 and proxyquire-1.6.0.

/Users/kevin/Projects/omnisearch/node_modules/proxyquire/lib/proxyquire.js:117
    if (hasOwnProperty.call(stubs[key], '@global')) {
                       ^
TypeError: Cannot convert undefined or null to object
    at hasOwnProperty (native)
    at Proxyquire.load (/Users/kevin/Projects/omnisearch/node_modules/proxyquire/lib/proxyquire.js:117:24)
@thlorenz
Copy link
Owner

Looks like you passed undefined or null as stubs.
If you need more help, please push your code to github so we can just clone it and run npm test to see the problem.

@nivthefox
Copy link
Author

Unfortunately this code is proprietary software and I cannot publish it anywhere. I have double checked every call to proxyquire() that I've made, and in all of them, the second argument is a valid object.

@bendrucker
Copy link
Collaborator

It's not the object, it's the values:

if (stubs[key] === null) continue;
if (hasOwnProperty.call(stubs[key], '@global')) {

You must have a key that's undefined -- null is handled. Not a fan of taking undefined in order to indicate that a stub shouldn't be available, but we could throw when undefined shows up.

@bendrucker
Copy link
Collaborator

This is not a proxyquire bug but I opened #74 so the error is more helpful

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

3 participants