The newly created react-test-renderer finally enabled testing of react-native components. Through the jest-react-native preset (now merged directly into react-native) Jest now works out of the box for any React project and comes pre-configured in create-react-app and react-native projects. We integrated core pieces of Jest into react-native's packager and the completely new snapshot testing feature has since been used outside of Jest: It was integrated with React Storybook as “storyshots” and is being adopted by other test runners like ava.
The pretty-format project was rewritten with performance in mind to drive Jest's snapshot feature, was recently merged into Jest's monorepo and is also helpful in other test runners. Nowadays Jest is much more about collecting different ideas and solutions to testing than it is about one specific implementation of a test framework.
I'd like to deeply thank all the people that have contributed to Jest this year, both from the open source community and at Facebook: Dmitrii Abramov, Cristian Carlesso, Dan Abramov, Daniel Lo Nigro, Maxim Derbin, Evan Scott, Forbes Lindesay, Keyan Zhang and 60 more people. We'd also like to welcome Michał Pierzchała (@thymikee) as first official external contributor to Jest. He's been doing a great job managing the issues and PRs on the repo. If you'd like to start contributing to Jest, we have a bunch of good first tasks and we are always happy to help on our discord channel.
Amjad Massad built a Jest container so you can now try out Jest directly in the browser. You can use it from now on when creating GitHub issues which should help troubleshoot problems more quickly. Amjad and Haya are building repl.it to democratize programming by building powerful yet simple tools and platforms for educators, learners, and developers. They are also hiring talented engineers!
Here is what happened in the community in the last two months:
- Jason Bonta and Dmitrii Abramov redefined the “testing pyramid” we were talking a lot about at Facebook.
- jest-codemods now allows you to painlessly migrate from Mocha, Tape and Ava to Jest.
- The React team announced improvements to the react-test-renderer in 15.4.0.
- Orta Therox build an amazing vscode-jest integration and donated the code for editor support to Jest.
- Pavithra Kodmad is documenting Flipkarts adoption of Jest and shares some getting started tips.
- Kent C. Dodds wrote about migrating to Jest at Paypal and Jason Brown wrote about migrating to Jest as well.
- Ben McCormick wrote about saving time with Jest.
- Eric Clemmons wrote about snapshots and storybook integration.
- Edvin Erikson wrote about getting Tap output in Jest.
- jest-html can bring snapshot diffing to your browser.
- There were a few great conversations on hackernews about Jest.
- The community started a great discussion about the future of enzyme.
- Ruben Oostinga wrote about combining chai and Jest matchers.
- Emil Ong wrote about why “TDD'ing your frontend seems pointless”.
- Nate Hunzaker wrote about end-to-end testing with Jest and Nightmare.
- Using Jest with Angular just works according to Matthieu Lux.
- A fantastic conversation about the purpose of snapshot testing is happening right now.
- Dmitrii made a new music video with his metal band.
- lazyspec can help you create smoke tests quickly if you are introducing tests to an existing codebase.
- Patrick Stapfer did a lightning talk about vim and Jest.
- Mark Dalgleish was commenting on the value of snapshot testing.
Jest was initially created more than five years ago and as such an old framework it has accumulated some technical debt. This is why we tend to make breaking changes more often than may seem necessary: We believe it is important to incrementally reduce technical debt to ensure that Jest as a project stays maintainable long-term. We didn't announce Jest 17 in a blog post and if you haven't upgraded to it in the last month you may find the changelog useful.
- Breaking: Removed
pitin favor of
mockImplin favor of
- Breaking: Renamed
- Breaking: Updated
- Breaking: Replaced
scriptPreprocessorwith the new
- Breaking: The
testResultsProcessorfunction is now required to return the modified results.
- Potentially Breaking: Properly resolve
testResultsProcessorwith a resolution algorithm instead of using
path.resolve. This mainly means that
<rootDir>is no longer needed for these options.
jest-editor-supportwere merged into Jest.
--testResultsProcessoris now exposed through the cli.
- Added: Implemented file watching in
- Added: Usage of Jest in watch mode can be hidden through
expect.assertions(number)which will ensure that a specified amount of assertions is made in one test.
.toMatchSnapshot(?string)feature to give snapshots a name.
- Added: Added support for custom snapshots serializers.
- Added: Big diffs are now collapsed by default in snapshots and assertions. Added
-e) to show the full diff.
--jsonnow includes information about individual tests inside a file.
test.concurrentunhandled promise rejections.
jest.mockwith three arguments.
- Fixed: The
jest-environment-nodenow comes from the vm context instead of the parent context.
- Fixed: Jest does not print stack traces from babel any longer.
- Fixed: Fake timers are reset when
- Fixed: Regular expressions are properly escaped in snapshots.
- Fixed: Improved pretty printing of large objects.
NaN% Failedin the OS notification when using
- Fixed: The first test run without cached timings will now use separate processes instead of running in band.
test.concurrentnow works with
- Fixed: Improved
- Fixed: Properly resolve modules with platform extensions on react-native.
- Fixed: global built in objects in
jest-environment-nodenow work properly.
- Fixed: Create mock objects in the vm context instead of the parent context.
.babelrcis now part of the transform cache key in
- Fixed: docblock parsing with haste modules.
- Fixed: Exit with the proper code when the coverage threshold is not reached.
- Fixed: Jest now clears the entire scrollback in watch mode.
jest-react-nativewas deprecated and now forwards
Six months ago we shared our plans for Jest and we are happy that we were able to execute well on almost all of them. For the next six months, here is what we are planning:
- Instant feedback: Nuclide integration and an improved and faster watch mode.
- Improved developer experience: new mocking APIs and improved assertions.
- Better performance and memory usage: analyze Jest and be more conscious about efficiency.
- Snapshot Improvements: snapshot approval mode, syntax highlighting and improved
- Website: We'll overhaul the website and documentation and add a Jest cheat sheet.
We won't be providing timelines or estimates for these features and we may not actually get to all of these things. If you'd like to help make these things a reality, send us issues and pull requests with your ideas and let's work on improving Jest together in 2017.