Closed chr0m1ng closed 3 days ago
Presumably your project uses es modules. If that's the case, you can't mock/stub exports since, iirc, the object (Foo
in this case) is unique per module/file
i.e you will be mutating the Foo
object but that is only local to the foo.spec.ts
. It won't affect the functions inside foo.ts
@43081j well I guess that's it then. Thanks!
I have the following setup:
But
chai.expect(mock).to.have.been.called.once
is throwing:When I debug the
foo.ts
file I can see thatinnerFunc
doesn't have the__spy
property, so it's not being mocked. Am I doing something wrong here or the library just don't cover this scenario?Versions: "chai": "^4.2.0", "chai-spies": "^1.1.0" "mocha": "^7.1.1"