Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tobi incompatible with should-style Chai #76

Open
zzen opened this issue Feb 24, 2012 · 2 comments
Open

Tobi incompatible with should-style Chai #76

zzen opened this issue Feb 24, 2012 · 2 comments

Comments

@zzen
Copy link
Contributor

zzen commented Feb 24, 2012

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 /Users/jakub/.nvm/v0.4.7/lib/node_modules/coffee-script/lib/coffee-script/command.js:135:29
    at /Users/jakub/.nvm/v0.4.7/lib/node_modules/coffee-script/lib/coffee-script/command.js:110:18
    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?)

@Almad
Copy link

Almad commented Feb 24, 2012

+1

1 similar comment
@seobyeongky
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants