You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is sort of an edge case, so I'd understand if you didn't want to bother with it. I just added this package to our jasmine suite, and .toBeFunction() is reporting "Expected Function to be function." The reason is that we are using sandboxed-module, which loads the subject under test using the vm module (in a separate context). instanceof doesn't seem to work when comparing objects from different contexts. E.g. (in our case):
// vm context - i.e. the subject-under-test
exports.a = function() {}
// test
expect(obj.a).toBeFunction() // fails because obj.a instanceof Function is false
For what's it worth, I don't blame you for this. The vm context instanceof problem is super annoying, and I've run into it before too. You might be able to do other checks in addition to instanceof to cover such cases. Something like return this.actual isntanceof Function || typeof this.actual === 'function' || this.actual.apply.
The text was updated successfully, but these errors were encountered:
This is sort of an edge case, so I'd understand if you didn't want to bother with it. I just added this package to our jasmine suite, and
.toBeFunction()
is reporting "Expected Function to be function." The reason is that we are using sandboxed-module, which loads the subject under test using thevm
module (in a separate context).instanceof
doesn't seem to work when comparing objects from different contexts. E.g. (in our case):For what's it worth, I don't blame you for this. The vm context instanceof problem is super annoying, and I've run into it before too. You might be able to do other checks in addition to
instanceof
to cover such cases. Something likereturn this.actual isntanceof Function || typeof this.actual === 'function' || this.actual.apply
.The text was updated successfully, but these errors were encountered: