Description
Main purpose of this issue is to track issues related to jest/typescript/testing tools used.
Take this as main go to document, for person/team which is gonna tackle migration to jest26/latest testing library/typescript 4
Current state (August 2021):
Versions used within our monorepo:
- Jest 24
- TS 4.1
- testing-library/react: 10.4.9.
I wanna bump testing-library/react
to v11
Now unblocked since we're using typescript 4.1 (>= 3.8), but not scheduled
Previous details:
@testing-library/react
v11 has as direct dependency on @testing-library/dom
version >=7.22.4
:
@testing-library/dom
, starting version7.22.4
, has direct dependency onpretty-format 26.x
- pretty-format 26.x:
- uses TS 3.8
type
syntax (thus making TSC explode as it parses unknown language syntax) - has direct dependency on
@jest/types 26.x
@jest/types 26.x
- uses TS 3.8 lang features as well (
import type {} ...
)
- uses TS 3.8 lang features as well (
- uses TS 3.8
- pretty-format 26.x:
💡 NOTE:
As a consequence of @testing-library/react
using dangerous ^
for its dom
dependency, we need to explicitly anchor it by ourselves via yarn resolution field to version -> @testing-library/dom": "7.22.3"
✅ done! I wanna bump typescript
to 3.9.x/4.1.x
typescript
to 3.9.x/4.1.xthis is done, expand for old notes
Upgrades to 3.8 and 3.9 were blocked by major bugs, which are fixed as of 4.0.More details of what will be involved in the typescript 4 upgrade are in #16101. Unfinished draft PR at #16449.
Why:
- TS 3.8: would have to dig up details of what the blocking bug was
- TS 3.9: issues with TS and webpack caused major bundle size increases for consumers in this version
- Consider emitting
export {}
in all ambiguous module output TypeScript#38696 - fixed in 4.0 - Empty Module Exports Dramatically Affect Bundle Output webpack/webpack#10889
- Message Elizabeth for link to internal upgrade attempt PR with more details
- Consider emitting
I wanna bump jest
to 27
Now unblocked since we're using typescript 4.1 (>= 3.8), but not scheduled.
Tracked by #18442
Why:
Jest 26 uses export type
which requires TS 3.8+.
On initial investigation, Jest 25 doesn't have these typing issues (at least with skipLibCheck
). Though when upgrading related dependencies you have to be careful to avoid installing anything that pulls in Jest 26-series packages.
Jest 25+ (more specifically its version of jsdom) appears to be required for running tests against React 17.
Related release notes: