Skip to content

Commit

Permalink
deps: Use Jest 26, the latest, with a resolutions hack.
Browse files Browse the repository at this point in the history
We've had Jest 26 as a direct dependency for a while (since
fb23341), so it's surprising that the `jest` command hasn't been
using it.

As Greg points out [0], that turns out to be because `jest-expo`
apparently provides its own wrapper for the `jest` command, using
the Jest that `jest-expo` depends on. That's Jest 25, even in
`jest-expo`'s latest. And Yarn ends up giving us that wrapper.

We know we'll soon want to use Jest 26 for a few things:

- The "modern" implementation of fake timers [1], for zulip#4165.

- The `selectProjects` CLI argument [2], for testing Android
  codepaths in a nice way (later in this series).

But we've *also* realized that we don't really want to jettison
`jest-expo` again, as we've done a few times as we learn new things:

62621ef jest: Add `jest-expo` preset, to be used in the next commit.
347aa96 jest: Back out `jest-expo` preset, for now.
c4fca9d jest: Add and use `jest-expo` preset, again.

In particular, we really want to use the `jest-expo/ios` and
`jest-expo/android` presets (which we'll do later in this series).

This is a hack because the `resolutions.jest-expo/jest` range
`^26.4.1` is incompatible with the original range that `jest-expo`
declares; that's `^25.2.0`. We believe this should get us a warning
from Yarn; according to a doc [3], "You will receive a warning if
your resolution version or range is not compatible with the original
version range." I haven't seen a warning like that, even after
removing node_modules and running `yarn`; this seems like a Yarn
bug.

I've opened expo/expo#12735 to bump Jest in the `jest-expo` project;
this hack should hopefully be fine while we wait for that.

[0] zulip#4700 (comment)
[1] https://github.com/facebook/jest/blob/master/CHANGELOG.md#2600
[2] https://github.com/facebook/jest/blob/master/CHANGELOG.md#2610
[3] https://classic.yarnpkg.com/en/docs/selective-version-resolutions/#toc-tips-tricks
  • Loading branch information
chrisbobbe committed May 10, 2021
1 parent 698b4de commit f1b59fe
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 613 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,8 @@
"rollup": "^2.26.5",
"typescript": "~3.8.3",
"yarn-deduplicate": "^3.0.0"
},
"resolutions": {
"jest-expo/jest": "^26.4.1"
}
}
Loading

0 comments on commit f1b59fe

Please sign in to comment.