-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Having mocked function return something else than undefined? #119
Comments
Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed. |
Unfortunately I don't think there is anything we can do about this. I'm going to close it out but feel free to reopen if you can think of a good fix for this! I agree it would be great if we could have a solution here. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I've bitten by Jest a few times now trying to alter an existing module and find the test broken, because one random function is now mocked and returns
undefined
. I know I should have checked the mocked list, but unfortunately this doesn't come naturally.I was wondering if we can return something like
new Error('This function is mocked, do not use its return value')
instead? This is just a wild idea. This would actually break things if, say, you store the return value in a map. But along this line, is there a way to warn the user about this?The text was updated successfully, but these errors were encountered: