我试图在expect中使用sinon,但是当我试图检查函数是否未被调用时,我得到:
TypeError: expect(...).to.have.not.been.called is not a function这就是我试过的:
expect(createCompany).not.to.have.been.called();
expect(createCompany).to.not.have.been.called();
expect(createCompany).to.have.not.been.called();
expect(createCompany).to.have.been.not.called();
expect(createCompany).to.have.been.notCalled();但是没有一个是有效的,但是没有".not“,我没有问题。
我的文件的开头是:
const chai = require('chai');
const sinon = require('sinon');
const sinonChai = require('sinon-chai');
chai.use(sinonChai);
const { expect } = chai;发布于 2021-12-24 10:10:48
好的,我发现这是因为父母。因此,只需将调用()替换为调用,它就能工作了。
https://stackoverflow.com/questions/70451207
复制相似问题