Closed gborobio73 closed 5 months ago
I had an almost identical issue to this but I found that if I bumped the versions of jest and ts-jest to versions ^v29 it resolved itself
I had an almost identical issue to this but I found that if I bumped the versions of jest and ts-jest to versions ^v29 it resolved itself
Oh, thanks! I'll try that 🙏
In my project, I tried to replicate the same matchers file (packages/aws-sdk-client-mock-jest/src/jestMatchers.ts
), and the same issue occurs.
However, I changed import {expect} from 'expect'
(this line: https://github.com/m-radzikowski/aws-sdk-client-mock/blob/main/packages/aws-sdk-client-mock-jest/src/jestMatchers.ts#L7) to import {expect} from '@jest/globals'
, and it suddenly started to work without upgrading the library.
Not sure why, but this was the import used in the Jest documentation too (https://jestjs.io/docs/expect#expectextendmatchers). Maybe consider making this change as a fix.
Using @jest/globals
types works with Jest 29.
Using @types/jest
works with both Jest 28 and 29.
See more on Jest types: https://jestjs.io/docs/getting-started#using-typescript
If there is still a problem using this setup, please reopen providing reproduction example and exact package versions.
Checklist
Bug description
Thanks a lot for this library 🙏
Jest matcher expect().toEqual() throws an error "TypeError: this.customTesters is not iterable". I'm not sure if this is the intended behavior.
Reproduction
Running this test results in:
If I remove the
import
everything works as expected.Thanks a lot!
Environment