You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ImportMock.mockClassInPlace() has now been added to the library. This will give you the same functionality as the original if you are simply mocking functions on classes.
Unfortunately the key functionality behind much of this library is based on the idea of swapping the original export with a mock export at the point the file is exported. This new Typescript change blocks that behaviour by ensuring all exports are only gettable so there is no way to set them during runtime.
If mockClassInPlace() doesn't solve your problem, you can look into running an older version of Typescript, or changing the way your project is compiled to avoid this Typescript issue.
Since typescript version 3.9, mocking imports is no longer supported as-is, due to this commit:
microsoft/TypeScript#32264
There is discussion on this issue regarding sinon mocking also broken by this commit:
microsoft/TypeScript#38568
It's a bit tldr; for me. Do you have any ideas for a workaround?
The text was updated successfully, but these errors were encountered: