You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import * as chai from 'chai';
import chaiSpies from 'chai-spies';
chai.use(chaiSpies);
const expect = chai.expect;
function sum(a, b) {
return a + b;
}
const spySum = chai.spy(sum);
expect(spySum).to.have.been.called.exactly(0);
The error is: TypeError: chai.spy is not a function
However, if I downgrade to v4.3.10 and use CJS with the following code:
const chai = require('chai');
const chaiSpies = require('chai-spies');
chai.use(chaiSpies);
const expect = chai.expect;
function sum(a, b) {
return a + b;
}
const spySum = chai.spy(sum);
expect(spySum).to.have.been.called.exactly(0);
It works.
The text was updated successfully, but these errors were encountered:
iampava
changed the title
Upgrade to ES Modules have broken chai-spies
Upgrade to ES Modules has broken chai-spies
Mar 4, 2024
iampava
changed the title
Upgrade to ES Modules has broken chai-spies
chai-spies broken in v5.1.0
Mar 4, 2024
The following code fails when using:
chai
: 5.1.0chai-spies
: 1.1.0The error is:
TypeError: chai.spy is not a function
However, if I downgrade to
v4.3.10
and use CJS with the following code:It works.
The text was updated successfully, but these errors were encountered: