-
Notifications
You must be signed in to change notification settings - Fork 76
Confusing error message when test finishes before expectation is called #149
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
Comments
Because the process is dead, we really can't know if it is because there are no expectations defined or because its callers crashed. So the best we can do is to add more information to the error message saying that all of its callers are dead. And perhaps say that "no expectations found" instead of "no expectations defined". WDYT @whatyouhide? |
Yeah there's not much we can do here, agreed. When the test process dies, we need to clear its expectations, so the task won't find any in its callers. I think the best we can do is to (maybe significantly) improve the error message. @axelson wanna make a PR? 🙃 |
I am interested in creating a PR for this, I've started one but haven't finished it yet. |
@axelson fantastic! Let us know if we can help. Would love a PR absolutely 🙃 |
@axelson ping? |
Thank you for the ping! I would still like to get to this but I haven't found the time yet. |
In the case where:
$callers
) is started from the test processA confusing error is raised. The error says that "no expectation defined for
<mock>
in process (or its callers)", but the given expectation was set in that processes callers. Here's an example error output for this case:Here's a git repo that reproduces the error: https://github.com/axelson/mox_repro
I have a suspicion that what is happening is that Mox is seeing that the test process has finished and clearing out the expectations.
Instead my ideal behavior would be to either keep the expectation valid or modify the error message to say that expectations against now dead processes are not valid.
The text was updated successfully, but these errors were encountered: