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
For our own Angular TypeScript repo, I encountered the following error when I tried out testdouble-jest: It appears the test is being run by Jest, but the testdouble-jest module has not been initialized.... I did do the initialisation with require('testdouble-jest')(td, jest) and the mock function was added to the imported testdouble module, but it was not available in the module when required again here.
I tried to reproduce this by taking the example tests from this repo, porting them to TypeScript and updating to the latest version of Jest. See #6. Unfortunately, the error did not occur there, but at the same time all the test cases fail for other reasons. I haven't had time to investigate this any further, but am posting this here in case someone from the testdouble team would like to look at this.
The text was updated successfully, but these errors were encountered:
When I was looking through td-jest's documentation, and with knowledge of some parts of jest.mock's internals, td.mock will need to have special code transformer logic to hoist the mock module declarations above imports for mocking to work properly. I'm not sure if that is the case here, but it certainly is Test Double Trouble.
I'll be honest in that I've always avoided using Jest and only slapped this module together well enough to get it to work at initial release. There's not much code here, though, so if someone has an idea on how to fix it and an interest in helping, I'd appreciate!
For our own Angular TypeScript repo, I encountered the following error when I tried out testdouble-jest:
It appears the test is being run by Jest, but the testdouble-jest module has not been initialized...
. I did do the initialisation withrequire('testdouble-jest')(td, jest)
and themock
function was added to the imported testdouble module, but it was not available in the module when required again here.I tried to reproduce this by taking the example tests from this repo, porting them to TypeScript and updating to the latest version of Jest. See #6. Unfortunately, the error did not occur there, but at the same time all the test cases fail for other reasons. I haven't had time to investigate this any further, but am posting this here in case someone from the testdouble team would like to look at this.
The text was updated successfully, but these errors were encountered: