-
-
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
expect(jest.fn().mock.calls)toStrictEqual([]) fails #7929
Comments
Just checked, indeed |
Forgot to mention that this was working as intended in jest@<24. |
I agree it's a bug, but it's recommended to not rely on the internal structure of the mocks. If you want to verify the mock hasn't been called, you can do
Equality checks shouldn't care about the prototype... So I'd say this is an issue with |
Sorry, my statement was inaccurate - |
@SimenB I'm actually using it in place of expect(fn).toHaveBeenCalledTimes(number);
expect(fn).toHaveBeenNthCalledWith(1, arg1, agr2);
expect(fn).toHaveBeenNthCalledWith(2, arg1, agr2); so I can either use that or create a new array from expect(Array.from(fn.mock.calls)).toStrictEqual([
[arg1, arg2],
[arg1, arg2]
]); Both are ok but I think that the documentation should mention that |
It's definitely a bug that should be fixed 🙂 |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 14 days. |
Please keep this open. I would love to see this get fixed |
PR welcome! 😀 |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
I have one idea that I am not too sure about and I will try to create a PR. |
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. |
🐛 Bug Report
The following expectation
fails
To Reproduce
Expected behavior
Test passes.
Link to repl or repo (highly encouraged)
Please provide either a repl.it demo or a minimal repository on GitHub.
Issues without a reproduction link are likely to stall.
Run
npx envinfo --preset jest
Paste the results here:
npx: installed 1 in 1.068s System: OS: macOS 10.14.3 CPU: (16) x64 Intel(R) Xeon(R) W-2140B CPU @ 3.20GHz Binaries: Node: 11.10.0 - /usr/local/bin/node npm: 6.7.0 - /usr/local/bin/npm
The text was updated successfully, but these errors were encountered: