Skip to content
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

Support testEnvironment=jest-environment-jsdom with pnpm #6145

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@
([#5505](https://github.com/facebook/jest/pull/5505))
* `[jest-util]` Fix `console.assert` behavior in custom & buffered consoles
([#5576](https://github.com/facebook/jest/pull/5576))
* `[jest-runner]` Add test environment dependencies to package.json
([#6145](https://github.com/facebook/jest/pull/6145))
* `[jest-config]` Remove test environment dependencies from package.json
([#6145](https://github.com/facebook/jest/pull/6145))

### Features

Expand Down
2 changes: 0 additions & 2 deletions packages/jest-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
"babel-jest": "^22.4.1",
"chalk": "^2.0.1",
"glob": "^7.1.1",
"jest-environment-jsdom": "^22.4.1",
"jest-environment-node": "^22.4.1",
Copy link
Contributor

Choose a reason for hiding this comment

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

You cannot remove them from here, because they are required by the following line:

https://github.com/facebook/jest/blob/master/packages/jest-config/src/utils.js#L123

If you remove them from the package list, you start relying on the hoisting to make sure that the environments are siblings of jest-config, which is an unsafe assumption.

Copy link
Author

Choose a reason for hiding this comment

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

Looks like a require based on a runtime variable is done in both jest-runner and jest-config. I guess that has implications on @SimenB's suggestion "pass a full path through to the runner" too.

I suppose that leaves us with the option of some refactoring towards dependency injection, and maybe @pgonzal's suggestion with a require done at config time is a simple way to do that.

"jest-get-type": "^22.1.0",
"jest-jasmine2": "^22.4.2",
"jest-regex-util": "^22.1.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-runner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"exit": "^0.1.2",
"jest-config": "^22.4.2",
"jest-docblock": "^22.4.0",
"jest-environment-jsdom": "^22.4.1",
"jest-environment-node": "^22.4.1",
"jest-haste-map": "^22.4.2",
"jest-jasmine2": "^22.4.2",
"jest-leak-detector": "^22.4.0",
Expand Down