tj / should.js

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

Strings converting to hashes using equal? #82

Closed kevinohara80 closed 12 years ago

kevinohara80 commented 12 years ago

I opened up a project that I hadn't touched for months today and I ran my mocha tests that leverage should. All tests were failing. I then noticed on should.equal, strings were being converted to hashes like so...

From the repl...

> var should = require('should');
undefined
> 'Blah'.should.equal('Blah');
AssertionError: expected { '0': 'B', '1': 'l', '2': 'a', '3': 'h' } to equal 'Blah'
    at Object.Assertion.equal (/Users/kevinohara80/dev/projects/node/elkington/node_modules/should/lib/should.js:297:10)
    at repl:1:15
    at REPLServer.self.eval (repl.js:111:21)
    at rli.on.e (repl.js:260:20)
    at REPLServer.self.eval (repl.js:118:5)
    at Interface.<anonymous> (repl.js:250:12)
    at Interface.EventEmitter.emit (events.js:88:17)
    at Interface._onLine (readline.js:183:10)
    at Interface._line (readline.js:502:8)
    at Interface._ttyWrite (readline.js:720:14)

Any idea what is happening? The only thing that has changed is my version of node (on v0.8.5).

lemonad commented 12 years ago

Same for me. Both 'test'.should.eql('test'); and 'test'.should.equal('test'); fails here with node@0.8.8, should@0.6.0 and mocha@0.14.1:

1) string equals should work:
   AssertionError: expected { '0': 't', '1': 'e', '2': 's', '3': 't' } to equal 'test'
    at Object.Assertion.eql (/Users/jonas/Projects/node.js/hawfinch/node_modules/should/lib/should.js:285:10)
    at Context.<anonymous> (/Users/jonas/Projects/node.js/hawfinch/test/t.js:3:19)
    at Test.Runnable.run (/opt/local/lib/node_modules/mocha/lib/runnable.js:156:32)
    at Runner.runTest (/opt/local/lib/node_modules/mocha/lib/runner.js:272:10)
    at Runner.runTests.next (/opt/local/lib/node_modules/mocha/lib/runner.js:316:12)
    at next (/opt/local/lib/node_modules/mocha/lib/runner.js:199:14)
    at Runner.hooks (/opt/local/lib/node_modules/mocha/lib/runner.js:208:7)
    at next (/opt/local/lib/node_modules/mocha/lib/runner.js:157:23)
    at Runner.hook (/opt/local/lib/node_modules/mocha/lib/runner.js:176:5)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)
tj commented 12 years ago

update should to 1.1.0