tj / should.js

BDD style assertions for node.js -- test framework agnostic
MIT License
2.75k stars 195 forks source link

require("should").eql == null => true #17

Closed weepy closed 11 years ago

weepy commented 13 years ago

fresh install

npm install should

node

require("should").eql == null true

what is happening ?

lackac commented 13 years ago

@weepy, the exported object from should is not the same as you get when accessing the property with the same name on any object. Only the exist property and some modifiers are available on it. See the section titled "exist (static)" in the README. That said, it seems that should doesn't work well in REPL.

Try running the following code with node and it may clarify it more:

var should = require("should");
console.log("should.eql", typeof should.eql);
console.log("should.exist", typeof should.exist);                        
console.log("'foo'.should.eql", typeof "foo".should.eql);

It will print the following:

should.eql undefined
should.exist function
'foo'.should.eql function