Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

Fixed an apparent loss of the original loader #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

davidporter-id-au
Copy link

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.

@cspotcode
Copy link

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#7

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants