@types/jest was probably added at a time when Jest did not have any type annotations, but now that jest does have the annotations, it makes sense (in my opinion) to switch to using those. Some drawbacks:
jest requires more verbose type annotations
jest does not declare any global objects, so we have to do it by ourselves
jest's types are more strict, and slightly incorrect code that used to compile before no longer compiles (this is not necessarily a drawback, but it's the reason why the delta is so large)
In addition to removing @types/jest, this PR also:
removes some unused test functions
changes incorrect uses of mockResolvedValue(Promise.resolved(x)) with mockResolvedValue(x)
changes incorrect uses of toMatchObject(x) with toEqual(x)
Summary
This removes
@types/jest
in favor of@jest/types
and friends. This allows using jest and expect to their full potential, and allow using new features like this: https://github.com/iron-fish/ironfish/blob/d8dffe54b17a3555efb013230726c3bb19eef784/ironfish/src/testUtilities/matchers/transaction.ts.@types/jest
was probably added at a time when Jest did not have any type annotations, but now that jest does have the annotations, it makes sense (in my opinion) to switch to using those. Some drawbacks:In addition to removing
@types/jest
, this PR also:mockResolvedValue(Promise.resolved(x))
withmockResolvedValue(x)
toMatchObject(x)
withtoEqual(x)
Testing Plan
Documentation
N/A
Breaking Change
N/A