Closed pedrovieira closed 4 years ago
I've found the culprit! Looks like jest-when doesn't play well with expect.anything
. I've since changed it to expect.any(Function)
and it's working now
Nevermind, my lack of sleep made me completely miss the fact that I was using expect.anything
instead of expect.anything()
Well, consider this "issue" as a way to wish you all a great weekend 😁
Hi all, I recently started using this library but I'm not getting it to work with a mocked class method that receives a callback in one paramater.
Here's an example code (I'm using
ts-jest
here for themocked()
):Where
ExtensionStorage.getSettings
is of type(key: string, callback: (settings: string | null) => void): void
. In this case, the highlight line is never called. However, if I use the default way withoutjest-when
, it works:Any ideas? Thanks!