Code to reproduce the problem:
const spy = sinon.spy(console, 'log');
console.log('hello');
expect(spy).to.be.called();
Error message:
TypeError: testlab_1.expect(...).to.be.called() is not a function
I did a quick search, we are using should/as-function for expect, which has different Assertion class/constructor than regular should. Now should-sinon modifies only the Assertion prototype from should, not from should/as-function, therefore it does not add sinon-related assertions to our `expect.
See https://github.com/shouldjs/sinon/blob/3d1841d244316a02671b54a33660127def0dd8b6/should-sinon.js#L5
Workaround:
sinon.assert.called(spy);
Code to reproduce the problem:
Error message:
I did a quick search, we are using
should/as-functionforexpect, which has differentAssertionclass/constructor than regularshould. Nowshould-sinonmodifies only theAssertionprototype fromshould, not fromshould/as-function, therefore it does not add sinon-related assertions to our `expect.See https://github.com/shouldjs/sinon/blob/3d1841d244316a02671b54a33660127def0dd8b6/should-sinon.js#L5
Workaround: