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
Hi there. Thanks for making such an awesome library. I dusted off an old project, updated all its dependencies, moved from CJS to ESM, and spent some time getting it to compile and run again. Now I'm fixing up my tests and I've run into an interesting error.
TypeError: Cannot assign to read only property 'Config' of object '[object Module]'
at new MockManager (node_modules\ts-mock-imports\src\managers\mock-manager.ts:17:33)
at Function.ImportMock.mockClass (node_modules\ts-mock-imports\src\import-mock.ts:10:31)
at Context.<anonymous> (file:///C:/Users/reach/IdeaProjects/csgo-demo-helper/test/services/DemoPlaybackHelper.test.ts:38:33)
at processImmediate (node:internal/timers:476:21)
When ImportMock.mockClass() is run, I get the above error. I was curious if this is different than #24 or if it's the same but the wording of the error has changed. #24 is caused by a change made in Typescript 3.9 but my code was on Typescript 4.1.3 previously with the mocks working just fine which is what makes me curious if this issue could be different.
The text was updated successfully, but these errors were encountered:
This either looks like the same issue as #24, or there is some other place in your exports where the class Config is being set to readonly. I have run the code you've provided against the unit tests and everything is working as expected.
Hi there. Thanks for making such an awesome library. I dusted off an old project, updated all its dependencies, moved from CJS to ESM, and spent some time getting it to compile and run again. Now I'm fixing up my tests and I've run into an interesting error.
Problematic code:
Snippet of Config.ts
When
ImportMock.mockClass()
is run, I get the above error. I was curious if this is different than #24 or if it's the same but the wording of the error has changed. #24 is caused by a change made in Typescript 3.9 but my code was on Typescript 4.1.3 previously with the mocks working just fine which is what makes me curious if this issue could be different.The text was updated successfully, but these errors were encountered: