What news from AWS re:Invent last week will have the most impact on you?
Amazon Q, an AI chatbot for explaining how AWS works.
Super-fast S3 Express storage.
New Graviton 4 processor instances.
Emily Freeman leaving AWS.
I don't use AWS, so none of this will affect me.
Frontend Development / Open Source

Jest: Meta’s JavaScript Testing Framework Joins OpenJS

After releasing an update to its JavaScript testing framework, Jest, Meta announced it will be transitioning it to the OpenJS foundation.
May 20th, 2022 9:33am by
Featued image for: Jest: Meta’s JavaScript Testing Framework Joins OpenJS
Lead image via Shutterstock.

After releasing an update to its JavaScript testing framework, Jest, Meta announced it will be transitioning the technology to the OpenJS foundation.

I spoke with Rick Hanlon, frontend engineer at Meta and a member of the React core team, about Jest’s growth into the project we see today and its move to OpenJS. Hanlon was a Jest core contributor prior to working for Meta, giving him the ability to see the project has grown from both the inside and the outside.

“In 2014, Jest officially became open sourced,” he said. “From then to around 2016, it was worked on sort of part-time by engineers until they decided to build a team around it. Cristoph Nakazawa, who worked for Meta at the time and is still a Jest core contributor, completely revamped it. He and his team created most of the features people really know Jest for today, such as the watch mode, error messaging, error reporting, and the really big testing experience.”

Hanlon continued, “That work went on until 2018, which is when I got involved in the project. From the beginning, not only with Jest but with previous languages we built, there was an ethos internally where if you’re creating something that can be valuable to the community, then it should be open sourced.”

How .jst Evolved into Jest

Jest is the latest version of a framework that has been developing for over ten years. In the olden days, when Meta was still Facebook and was busy fine-tuning its messenger service, .jst was solely used internally. Hanlon gave some insight as to how Jest went from an internal language to an open source project.

“Though .jst was built for our messenger platform in 2011,” he explained, “it quickly turned into something else over the years. We really needed some high performance tests, among other things, and it just took off from there. Since it wasn’t tied directly to Facebook, it was a great candidate for open source. Plus, it was super useful for testing React apps and Facebook had just open sourced React around that time.”

Three years later, Jest debuted as open source and quickly gained contributors and a bubbling community. By 2018, the Jest Open Collective was formed and began raising money for developers outside of Meta to contribute to the project. To date, nearly $80,000 has been raised for the Jest community.

“Cristoph and Meta put together the open collective as a way to sponsor non-Meta employees,” said Hanlon. “Meta themselves have contributed over the years at least $22,000 to the fund directly. They’ve been supportive of open source maintainers and allowed us to fund meetups where contributors can get together and actually meet each other, which was great.”

I asked Hanlon why Jest became so much more dynamic after the open collective was started, and his answer was simple. More developers plus more funds equaled a significant improvement in features to the already popular Jest, including inline snapshots and ESM support.

Testing Made Easy

Jest’s tagline promises “delightful’ testing. During our interview, I asked Hanlon to give us an in-depth look at what Jest offers that makes it such a pleasure for developers to use.

“I think there’s a lot that makes it delightful,” he replied. “I can speak to what blew me away when I saw Jest for the first time — and for one, it was the performance. It just performed way better than anything else out there. Secondly, the watch mode. Just being able to automatically have your test run as you’re changing your code without having to switch back and forth and rerun them. It constantly watches for file changes and automatically runs the tests that are only relevant to the files that were changed. It’s incredible for developer velocity improvement. Finally, the reporting — it’s clear when things fail and when things pass what tests are running. We put a lot of effort into really clear error messages so developers aren’t spending unnecessary time decoding them just to fix a problem.”

Hanlon went on to say, “The zero config is a great point as well. It can be hard to configure everything, get started, figure out which test files are which, etc. The ‘out of the box’ experience works really well. The other thing is [that] Jest is consistent across projects. You can do a lot of customization, but it kind of forces the standardization across the project. So if you go into two different projects that are using Jest, you usually understand what’s roughly going on and be able to start contributing very quickly.”

The OpenJS Foundation

Jest moving to the OpenJS Foundation is a step in the right direction for the open source community, says Hanlon. “This move will be mostly an organizational move. And with that, what it’s going to be able to allow us to do is grow outside of Meta and be able to grow those numbers. Which in turn will allow us to build more features. Also, it will allow us to get folks who have never contributed to open source before to contribute.”

The OpenJS Foundation is home to a multitude of JavaScript staples, including Node.js and jQuery. Like all projects when they first are absorbed by OpenJS, Jest is in the incubating stage undergoing an onboarding checklist. After the OpenJS onboarding process is complete, Jest will find itself in either the Impact or At-Large Stage project. OpenJS Foundation Cross Project Council chairperson Joe Sepi said, “The OpenJS Foundation is the neutral home to many projects in the community, and I expect Jest will flourish as a new member of the family of projects here. I believe that having it under open governance will reinvigorate its contributor base, and we will see that base grow. I also hope that its leadership engages in our foundation and the Cross Project Council to continue to improve the way we support our projects and their communities and the overall JavaScript ecosystem.”

According to Hanlon, the transition will further empower the Jest community to improve their skills and grow their numbers. Open source projects are by the community, for the community, and he says Jest is no different.

“I think one of the things that are the most satisfying for me while working at some of these larger open source projects is just being able to meet people who are new to open source and help them submit their first changes, or answer questions and be able to support them and invite them into the community and help them along in their career.,” he said. “You’ll run into people who are new to programming or have been programming for a long time, and it’s just a really great opportunity to be able to meet a lot of like-minded folks.”

Finally, he noted that Meta’s open source team has been very helpful to the process of transitioning to OpenJS.

“It’s awesome because we have a supportive full-fledged team that makes it easy for us to contribute to open source,” he said, “but then we also have very different specialized communities within each project. What’s been great about Jest is that we were able to build this community around Jest, and eventually they [the community] kind of just took off with it on their own.”

Group Created with Sketch.
THE NEW STACK UPDATE A newsletter digest of the week’s most important stories & analyses.