Skip to content

Support jest 28 to 30#56

Open
jvincent42 wants to merge 1 commit into
mainfrom
jvincent/jest-peer-dependencies
Open

Support jest 28 to 30#56
jvincent42 wants to merge 1 commit into
mainfrom
jvincent/jest-peer-dependencies

Conversation

@jvincent42
Copy link
Copy Markdown
Contributor

Moves jest-environment-jsdom and jest-environment-node from dependencies to peerDependencies so consumers control which jest version is installed.
Supports jest 28, 29, and 30.

BREAKING CHANGE: consumers must now install the jest environment package themselves.

Updated README.md with installation instructions. Requires a major version bump.

@jvincent42 jvincent42 requested a review from a team as a code owner May 28, 2026 10:53
@jvincent42 jvincent42 force-pushed the jvincent/jest-peer-dependencies branch from b80e78f to a92f960 Compare May 28, 2026 11:03
Comment thread README.md
For Node-based tests:

```shell
pnpm add -D jest jest-environment-node
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

~ Should we show these examples installing a particular major version?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could add it, but usually node users know how to target specific versions using @ .

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My expectation is that people will copy/paste the command. Or leave it to a LLM to copy/paste the command.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A LLM should be able to determine which version of the environment is required and how to install it. However, I can add a more specific example so people don't have to look for the documentation or search the web on how to do that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an example to README.md.

Comment thread test/integration.test.ts

execSync(
`pnpm jest --config="${configFile}" --no-cache --silent=false --useStderr`,
`node "${install.bin}" --config="${configFile}" --no-cache --silent=false --useStderr`,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

~ Is there a reason for the switch away from pnpm?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we need to use node to directly invoke a specific version of jest. pnpm can't do that it would always call jest 30, the one we use for actually running the integration test.

Comment thread test/integration.test.ts Outdated
env: {
...process.env,
NODE_OPTIONS: '--experimental-vm-modules',
env: childEnv({
Copy link
Copy Markdown
Member

@gordonsyme gordonsyme May 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

~ what's the benefit of the childEnv fn?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was used for more complex env manipulation, but I guess we can remove it, since it's only doing simple env manipulation now.

@jvincent42 jvincent42 force-pushed the jvincent/jest-peer-dependencies branch 4 times, most recently from 5419c67 to af2f265 Compare May 28, 2026 12:43
@jvincent42 jvincent42 force-pushed the jvincent/jest-peer-dependencies branch from af2f265 to cd5ad47 Compare May 29, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants