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
Bad typing for toHaveBeenCalledOnceWith
causing problems
#518
Comments
I'm seeing the same problem. I just started using I agree, it seems like this matcher was added recently and needs additional implementation |
Yea, this was a simple goof in the type file. We currently lack test coverage of our types, but this is something we plan on adding. |
Why has this been closed? Can we close the issue when this would be solved (with the new version, I suppose?) |
Any plans for releasing this fix @keeganwitt ? We would like to have used |
Simen just did a 3.2.0 release that contains this fix. |
Wow, that was fast 🚀 |
@keeganwitt I don't think this was properly addressed, now I'm getting I believe that Should we reopen this or create a new issue? |
I believe the fix we shipped makes the type match the current implementation. Only the first argument is actually compared. const mock = jest.fn();
mock('hello', 'there');
expect(mock).toHaveBeenCalledOnceWith('hello', 'not there'); Passes even though it'd be preferable that it not. Being able to do this is what issue #517 is about. |
Yeah, good point, types change should be part of the fix for #517 in this case, thank you! |
Bug
package
version: 3.1.0node
version: 18.10.0npm
(oryarn
) version: 8.19.2What happened:
A test with the following line passes, but TypeScript complains with
Expected 0 arguments, but got 1. ts(2554)
:reveal
andrevealSpy
are defined as follows:I saw a recent commit described as "fixing toHaveBeenCalledOnceWith," so this may be a regression. Potentially related to #517. I've used
@ts-expect-error
to ignore the TS error for now. EDIT:expect(...).toHaveBeenNthCalledWith(1, ...)
also works as poor man's substitute. Thanks for your work on this package!Reproduction repository: https://github.com/Xunnamius/unified-utils/blob/b84a05ab0a10dd38b2c46062452f6c3e6cec194a/packages/mdast-util-hidden/test/unit-index.test.ts#L215
The text was updated successfully, but these errors were encountered: