Open davidporter-id-au opened 9 years ago
I think requiring mockery from inside a test where the cache has been cleared will have other ill effects. For example, mockery also stores info about stubs and mocks, not just originalLoader
, inside its closure.
I've fixed this in mockery-next by attaching a reference to mockery itself to module
. See cspotcode/mockery-next#7
I was getting an error with the
originalLoader
being lost somehow during my tests. I suspect it was because I was probably doing a combination of resetting caches and re-requiring in mockery in a cavalier fashion.Either way, by taking the reference out of the mockery closure and putting it on the module, it no longer suffers from this problem.