javascripttestingshould.js

How to disable should.js override "should" property?


One of the external libraries we're using is having a property called "should" in one of its classes.

When we run tests with shouldjs it seems like should instruments its class with its "should" which crashes the library.

How can we hint shouldjs to avoid instrument this class?


Solution

  • Just to fill all posibilities.

    You can require should.js via should/as-function and use it only as function, it will not try to extend Object.prototype in this case:

    should(1).be.a.Number();