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
should.not.exist(foo); // foo is undefined, so this should pass
But my whole Node environment blows up unexpectedly. After stepping into the code, I've found that the existence check is looking at the 'object' flag on the Assertion, which is set to the global object. Effectively, this means that the above instance check is comparing the global object against null, which fails (the Node implosion is somehow related to attempting to format the entire global object as a string in the assertion error message...separate issue).
Again, I've confirmed that this is the comparison actually happening. In core/assertions.js on line 301 (using the latest version of Chai published via npm), it is indeed comparing null to the global object. At no point do I ever see my 'foo' come into play.
Is there something I'm missing here? I've double checked that I'm calling require("chai").should(); and all my other should-based statements work just fine.
If there are any other details you need, please let me know.
The text was updated successfully, but these errors were encountered:
If you don't "locally" scope the should variable then it operates off of global.should, which is why the object flag for Assertion is the global object and everything explodes.
It sounds like your are not initializing the should interface correctly.
You should be doing:
require('chai').should(); // wrongvar should = require('chai').should(); // correct
If you don't "locally" scope the should variable then it operates off of
global.should, which is why the object flag for Assertion is the global
object and everything explodes.
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/260#issuecomment-41950278
.
I'm trying to do a simple existence check:
But my whole Node environment blows up unexpectedly. After stepping into the code, I've found that the existence check is looking at the 'object' flag on the Assertion, which is set to the global object. Effectively, this means that the above instance check is comparing the global object against null, which fails (the Node implosion is somehow related to attempting to format the entire global object as a string in the assertion error message...separate issue).
Again, I've confirmed that this is the comparison actually happening. In core/assertions.js on line 301 (using the latest version of Chai published via npm), it is indeed comparing null to the global object. At no point do I ever see my 'foo' come into play.
Is there something I'm missing here? I've double checked that I'm calling require("chai").should(); and all my other should-based statements work just fine.
If there are any other details you need, please let me know.
The text was updated successfully, but these errors were encountered: