-
Notifications
You must be signed in to change notification settings - Fork 29
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
Strange equals comparison testing jest mock calls - workaround incl #445
Comments
That looks interesting, we will definitely look into that. Might it just be a type that is trying to fake being an array? |
I don't think I have a setup where I can easily reproduce this. Seems like we will only emit this error message when Also, does |
and expect(resp.status.mock.calls, 'to satisfy', [[500]]); does indeed work - thanks so much already! |
Jest does use the
Each const expect = require('./lib/');
const vm = require('vm');
const foreignArray = vm.runInNewContext(`['foo']`);
expect(foreignArray, 'to equal', ['foo']); Output:
Not sure what we should do about that. I don't think we should try to change the semantics, but we could display a friendlier error message that hints at this. |
Thanks so much already! I think we (rather: you!) did the most important thing - put information out helping anyone encountering the same. |
I wonder if there is another option here - at some point as part of the On a broader note, this is sort of an interesting case and it's consistent with what I've seen of some of the niggles that occur due to the extent to which jest tries to isolate things. As per @papandreou no idea what we can do about this more generally, but it's with pondering this some. |
Per se, unexpected is great for (amongst other things) comparing more complex structures - including the calls to a mock.
There is a glitch, however: The following line fails w/ a somewhat strange error message:
msg is:
What does work is this:
I didn't yet figure out what the root cause is. And there's a workaround, so it's not really critical.
Just wanted to let you know about the workaround (and I'm sure grateful if s/o can point me to an existing solution).
The text was updated successfully, but these errors were encountered: