1

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?

Guy Korland
  • 9,139
  • 14
  • 59
  • 106

2 Answers2

1

You can use should.noConflict to tell Should.js to use a different name than should. Should.js adds the name it uses to Object.prototype, which unsurprisingly can cause a bit of trouble...

T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875
1

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();
den bardadym
  • 2,747
  • 3
  • 25
  • 27