tobi = require('tobi')
chai = require('chai').should()
Produces an error:
TypeError: Property 'should' of object #<Object> is not a function
at Object.<anonymous> (/Users/jakub/Documents/apiary/test.coffee:6:26)
at Object.<anonymous> (/Users/jakub/Documents/apiary/test.coffee:8:4)
at Module._compile (module.js:404:26)
at Object.run (/Users/jakub/.nvm/v0.4.7/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:68:25)
at [object Object].<anonymous> (fs.js:107:5)
at [object Object].emit (events.js:61:17)
at afterRead (fs.js:878:12)
at wrapper (fs.js:245:17)
The opposite require order works fine. This is super non-intuitive, just spent the last 30mins debugging this.
The reason for this is that tobi tries to require should.js, should.js extends Object.prototype including nuking the setter for the Object.prototype.should property. A while later, chai#should also tries to extend Object.prototype in the same way but is blocked by the empty setter.
Since should.js seems to be a convenience anyway, could we remove it out of the instantiation (perhaps make the attaching of tobi extensions to should.js optional?)