chaijs / sinon-chai

Extends Chai with assertions for the Sinon.JS mocking framework.
Other
1.09k stars 107 forks source link

Error: Invalid Chai property: calledTwice #155

Open naissa12 opened 2 years ago

naissa12 commented 2 years ago
Error: Invalid Chai property: calledTwice
    at Object.e [as get] (.tmp/karma_webpack/commons.js:149088:1519)
    at Context.<anonymous> (.tmp/karma_webpack/commons.js:3840:101)
    at Test.Runnable.run (/home/asruser/project/common/temp/node_modules/.pnpm/karma-mocha-snapshot@0.2.1/node_modules/karma-mocha-snapshot/lib/adapter.js:14:17)

I'm seeing the error above when running unit tests. Can someone please help? I have sinon-chai installed. See my package.json:

       "@types/chai": "4.2.14",
        "@types/chai-as-promised": "7.1.3",
        "@types/query-selector-shadow-dom": "1.0.0",
        "@types/node": "14.14.36",
        "@types/sinon": "9.0.8",
        "@types/sinon-chai": "3.2.5",
cincodenada commented 2 years ago

That package.json snippet is not including sinon-chai (or chai, for that matter), it's including the DefinitelyTyped type definitions for Chai. Are you including the actual chai and sinon-chai elsewhere in your package.json?

Also, we won't really be able to help without seeing what your test code is doing - at least a snippet that's calling calledTwice and the part where you set up sinon-chai.