Skip to content
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

Closed
chenglou opened this issue Aug 14, 2014 · 3 comments
Closed

Having mocked function return something else than undefined? #119

chenglou opened this issue Aug 14, 2014 · 3 comments

Comments

@chenglou
Copy link
Contributor

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?

@ghost
Copy link

ghost commented Aug 5, 2015

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.

@cpojer
Copy link
Member

cpojer commented Oct 16, 2015

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.

@github-actions
Copy link

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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants