-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
How to use Jest for Node.js projects #5122
Comments
We do not have the time to support a version of Jest that is two versions behind the current LTS. Also, this decision was made for us by the jsdom team. There is no recommendation from us beyond using older versions of Jest. That said, if you'd like to make the latest version of Jest work with Node 4 and you are committed to supporting it until mid 2018, we are happy to accept pull requests and re-enable CI on Node 4. |
What was the problem of supporting Node.js 4? I can’t test it since I get yarn warning right now. It is about some very useful Node.js API or just using |
Also, Node.js 4 is current LTS ;). All 4, 6 and 8 are LTS. |
You'll have to ask the folks working on jsdom about that. Jest frequently segfaults on Node 4 which was fixed in later versions of Node. I generally don't recommend using Node 4 (for Jest) and would encourage you to push your company to upgrade to a later version which is about 2x faster, more stable and likely more secure. Please note that it doesn't matter to this project which versions of Node.js are LTS. At Facebook, we only use the latest LTS release or unstable version. I'd even go so far as to drop support for Node 6 but I understand that's taking it a bit far for some folks, and it isn't causing major issues for us right now (like, segfaults). |
@ai See their changelog regarding v10: https://github.com/tmpvar/jsdom/blob/master/Changelog.md#1000 |
We don’t use Node.js 4 too. But PostCSS has 25 M downloads, so we have many Node.js 4 users, which I must support until Node.js 4 is still current LTS. |
The problem that PostCSS doesn’t even use JSDOM :(. Can I install Jest 22 without JSDOM to use it for pure JS tests? |
Right now we've done nothing to remove node 4 support beyond upgrading to the latest version of jsdom in We might have some new issues as we haven't run node 4 on CI for a couple of months, but nothing major I wager.
Nope. That's more relevant when we wanna drop node 6 as we use a ton of
True, only the latter two are active LTS though, which I think counts for something.
If you use a lock file and ignore the warning from yarn about engines there should be no issue upgrading |
You should be good to do it. Just use |
Awesome! Thanks for this advice. I run Jest on Node.js 4, but have this issue right now (destructor syntax?):
What do you think about some unofficial Node.js 4 support. You don’t use Node.js 4+ syntax, but this support is not official and may require some hacks? |
Something like that 🙂 I would definitely recommend a lockfile though so it doesn't change from under your feet. PR welcome for you specific error here: |
I will send PR tomorrow :). And try to grep other |
I sent PR with |
I fixed all
I look into |
Done. Now Jest works for Node.js 4 too. Thanks to everyone. |
Thanks for pushing on this @ai! |
This exchange and the changes made by @ai make me wonder if #4947 needs to be done or not? |
Is there something specific I need to do to run jest under node 4 environments? |
@shawnmclean Node 4 gets it's end of life in 6 days, better use that time to migrate to Node 8 (latest LTS version) than figuring out your tools to work with soon unmaintained language. |
@thymikee thats my issue now. We're migrating to Node 8, but during that time, we want to maintain backwards compatibility with 4, hence having tests running under Node 4 for the time being. |
Jest 22 should work fine on node 4 as long as yiu use node env and not jsdom. Use jest 21 (or a custom jsdom env) if you need it |
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. |
TLTR: since Node.js 4 is still supported many companies use it and many Node.js projects (including PostCSS, Autoprefixer, Browserslist) must support it. What is a solution for them?
Of course, it is OK to run the only Node.js 9 on Travis CI for client-side projects like Jest. But Node.js projects is different.
What is your recommendation for the big Node.js project? Stick on Jest 21 until August 2018?
The text was updated successfully, but these errors were encountered: