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

jest-environment-jsdom in node < 6 #5211

Closed
ljharb opened this issue Jan 2, 2018 · 6 comments
Closed

jest-environment-jsdom in node < 6 #5211

ljharb opened this issue Jan 2, 2018 · 6 comments

Comments

@ljharb
Copy link
Contributor

ljharb commented Jan 2, 2018

By requiring jsdom v10 and above in v22, node 6 is required. This means jest v22 and above can't be used to test node packages that support node 4, which is still in LTS.

Could jest-environment-jsdom be pegged at jsdom@v9, to avoid this breakage?

@ljharb ljharb changed the title jest-environment-jsdom jest-environment-jsdom in node < 6 Jan 2, 2018
@ljharb
Copy link
Contributor Author

ljharb commented Jan 3, 2018

#4770 seems to suggest it's intentional, but that mean that jest isn't useful on a published package, most of which support multiple versions of node (typically all LTS versions at least).

What's the value in aggressively dropping support for older node versions? (@cpojer)

@thymikee
Copy link
Collaborator

thymikee commented Jan 3, 2018

@ljharb you can use custom environment with jsdom 9, see: #5122

@thymikee thymikee closed this as completed Jan 3, 2018
@ljharb
Copy link
Contributor Author

ljharb commented Jan 3, 2018

@thymikee i read that thread and I'm not sure how to use jest 22 with jsdom 9. can you elaborate? the "node" test environment doesn't help me run tests with jsdom.

@thymikee
Copy link
Collaborator

thymikee commented Jan 3, 2018

In #5122 we made sure Jest is being able to run (or rather compile itself) on Node 4.

Here's a brief doc on how to create a custom environment. What you need to do, is to import jsdom 9 there and use it accordingly, similarly to how it was done earlier.
It would be great to publish it as an npm module and reference it somewhere.

@thymikee thymikee reopened this Jan 3, 2018
@cpojer
Copy link
Member

cpojer commented Jan 3, 2018

What @thymikee said is correct. The main Jest installation doesn’t officially support node 4 any longer. However, you can build your own custom test environment with an older version of jsdom that should still work for you. Members from the community have stepped up to make Jest 22 work on node 4 again. Please note that Jest tends to segfault on node 4, at least when running Jest’s own test suite, so there are definitely some issues in node 4 that you can avoid by upgrading.

If that doesn’t work for you, Jest 21 will keep working fine on node 4.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants