-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add support for jest@27 #123
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor thing about versioning, otherwise LGTM!
@@ -1,5 +1,6 @@ | |||
version: 2.1 | |||
|
|||
supported-jest-versions: &supported-jest-versions ["local", "26", "27"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One unfortunate thing about this is that our tests could randomly start failing because of a change introduced in a minor/patch release of Jest 26 or 27. Some alternatives I can think of:
- Explicitly spell out the versions here (e.g.
["local", "26.6.3", "27.0.4"]
) - Add additional
devDependencies
like so:
"devDependencies": {
"jest": "^27.0.4",
"jest-26": "npm:jest@^26",
"jest-27": "npm:jest@^27"
}
Then we would need to do something like JEST_BIN=./node_modules/jest-26/bin/jest.js
to switch between them.
I slightly prefer the second option, because the versions would go in the yarn lockfile and therefore would be part of Circle CI's yarn cache. Also it would be easier to remember to update these versions, rather than keeping them in .circleci/config.yml
.
On the other hand, the second option is more complex and unusual. So I could go either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One unfortunate thing about this is that our tests could randomly start failing because of a change introduced in a minor/patch release of Jest 26 or 27.
Sounds like a feature to me! It would be great to run tests on every jest release but perhaps installing latest
per run is the next best thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is the intended behavior. Because we are using ^
to match against the jest peer dependency version, we don't have much control over the version of jest consumers' uses.
Ideally, we would need to run the test every time a new version of jest is published to catch bugs earlier. But it would be overengineering this issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's what I'm concerned about:
- This project isn't updated for a few months
- Someone opens a PR
- The PR's tests are broken in CI
- Now we have to spend time figuring out whether the PR broke things or a Jest update broke things
If we really want to stay on top of Jest updates, the solution IMO is something like Dependabot, not "random breakages when someone opens a PR or clones the projects and tries to test it." That doesn't even solve the problem, because the update cadence aligns with updates to this project, not updates to Jest.
To be fair, though, I don't know if Dependabot is smart enough to understand the npm:package@version
syntax. So this problem may be unsolveable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nolanlawson Agreed. Maybe we can add jest updates to the list of tasks for the weekly trust hero?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now we have to spend time figuring out whether the PR broke things or a Jest update broke things
This is why there are 3 different builds in the matrix: "local", "26", "27"
- The
local
build checks if the jest version frozen in the lockfile pass the tests - The
26
and27
builds checks if the latest versions of jest pass the tests
If the local
build pass and either 26
or 27
fails, it means that there is a regression or a bug in the latest version of Jest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, fair enough.
I get the willies about using |
Details
peerDependencies
field to include bothjest@26
andjest@27