From 7872dc6a29e51df61803f286b5fc9d2c8e32ced7 Mon Sep 17 00:00:00 2001 From: Nathan Rajlich Date: Sat, 31 Mar 2012 12:08:40 -0700 Subject: [PATCH 1/3] use valueOf() to get the reference the object. It seems as though new versions of V8 (as of node v0.7.7) will return an Object version of a primitive when it is referenced using "this", something silly like this would fail: var called = false called.should.equal.false AssertionError: expected {} to be false --- lib/should.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/should.js b/lib/should.js index 9df14dc..8559a49 100644 --- a/lib/should.js +++ b/lib/should.js @@ -78,7 +78,7 @@ exports.not.exist = function(obj, msg){ Object.defineProperty(Object.prototype, 'should', { set: function(){}, get: function(){ - return new Assertion(this); + return new Assertion(Object(this).valueOf()); }, configurable: true }); From 51d845ae772844a84bfcbf3d0085cd318af354ba Mon Sep 17 00:00:00 2001 From: Nathan Rajlich Date: Sat, 31 Mar 2012 12:30:04 -0700 Subject: [PATCH 2/3] remove 'should' from the package.json --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 60a8400..5ee6b6d 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,8 @@ , "contributors": [ "Aseem Kishore " ] , "devDependencies": { "mocha": "*" - , "should": "*" } , "keywords": ["test", "bdd", "assert"] , "main": "./lib/should.js" , "engines": { "node": ">= 0.2.0" } -} \ No newline at end of file +} From f88a3f42d4aa43bbcac0af15e21066f63905f84d Mon Sep 17 00:00:00 2001 From: Nathan Rajlich Date: Sat, 31 Mar 2012 12:30:15 -0700 Subject: [PATCH 3/3] fix test case for 'should' not being installed --- test/should.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/should.test.js b/test/should.test.js index 8dd2790..4afc21d 100644 --- a/test/should.test.js +++ b/test/should.test.js @@ -21,7 +21,7 @@ module.exports = { }, 'test double require': function(){ - require('should').should.equal(should); + require('../').should.equal(should); }, 'test assertion': function(){