Aller au contenu principal

Jest 27 : nouvelles valeurs par défaut pour Jest, édition 2021 ⏩

Dans l'article du blog pour Jest 26, il y a environ un an, nous avons annoncé qu'après deux versions majeures avec peu de modifications de rupture, Jest 27 basculera quelques interrupteurs afin de définir de meilleures valeurs par défaut pour les projets qui sont nouveaux ou qui peuvent migrer en douceur. Cela nous donne l'opportunité de retirer certains paquets de la distribution par défaut de Jest 28 et de les publier en tant que modules installables et connectables séparément. Tous ceux qui utilisent les nouvelles valeurs par défaut peuvent bénéficier d'une installation plus petite, tandis que ceux qui ont besoin de ces paquets peuvent toujours les installer séparément.

Avec le premier changement majeur des valeurs par défaut depuis les nouvelles valeurs par défaut pour Jest qui accompagnaient la version 15, Jest 27 est maintenant là, pour que Jest reste rapide, léger et pertinent dans le futur. Nous expliquerons ces changements de valeurs par défaut et d'autres changements notables dans cet article, mais tout d'abord, nous allons aborder les nouvelles fonctionnalités !

Jest 26 : Tic Tac

Lorsque nous avons commencé à reconstruire Jest il y a cinq ans, notre objectif était de fournir un exécuteur de tests sans configuration, accessible aux débutants, extensible pour presque tous les cas d'utilisation de tests et évolutif pour les grands projets. L'une des versions essentielles a été Jest 15, qui a tout regroupé et fourni de bonnes valeurs par défaut permettant aux gens d'exécuter Jest souvent sans aucune configuration. Cependant, cette approche a un gros inconvénient car Jest installe beaucoup de dépendances dans vos projets dont vous n'avez peut-être pas besoin.

Nous commençons à remédier à cette lacune et nous nous efforçons de réduire la taille de l'installation de Jest tout en le gardant accessible et extensible. Nous avons apporté les changements fondamentaux suivants dans Jest 26 :

Jest 25: 🚀 Laying foundations for the future

Jest 25 is laying the groundwork for many major changes in the future. As such, we kept breaking changes to a minimum, but internal architecture changes may require attention during the upgrade. The main changes are an upgrade of JSDOM from v11 to v15, 10-15% faster test runs, a new diff view for outdated snapshots and dropped Node 6 support.

There has been more than 200 commits since Jest 24.9 by more than 80 different contributors, so as always, take a look at the changelog for a full list of changes.

Jest 24: 💅 Refreshing, Polished, TypeScript-friendly

Today we are happy to announce the next major release of Jest - version 24! It's been 4 months since the last minor release, and 8 months since Jest 23, so this upgrade is a big one, with something for everyone! Highlights include built-in support for TypeScript by upgrading the Jest internals to Babel 7, fixing some long-standing issues with missing console output and performance issues when computing large diffs, and a brand new sparkling website. ✨

For a full list of all changes see the changelog.

Supporting Jest Open Source

Jest is maintained by a community of open source contributors and Facebook employees.

Our open source contributors work on behalf of the community to create new features, fix bugs, and maintain the issue backlog. Facebook employees do the same, focused on the problems specific to Facebook's scale, and run all proposed releases on Facebook's enormous test suite before publishing.

All of us do our part to make testing delightful.

At the Jest Summit we announced the Jest Open Collective. This is our way to help support the efforts of the open source Jest community. To be absolutely clear: Facebook employees cannot benefit from the Jest Open Collective. The collective's sole purpose is to support the open source side of the Jest community.

In this post we'll outline what the Jest Open Collective is, the structure, and the goals we have.

Jest 23: 🔥 Blazing Fast Delightful Testing

Today we are excited to announce Jest 23, our largest major release to date! Together with over 100 contributors, we've shipped a ton of features and bug fixes. Thank you to everyone in the community for helping make JavaScript Testing Delightful.

We would also like to welcome both Babel and Webpack to the Jest community! After converting from Mocha to Jest 23 Beta, Webpack saw their total test suite time reduced 6x from over 13 minutes to 2 minutes 20 seconds. #blazingmeansgood

Here's are some of the Jest 23 highlights and breaking changes.

Jest 22: Refinements & Custom Runners

Today we are announcing a new major version of Jest which refines almost all parts of Jest to provide a more solid testing foundation. Together with the Jest community we made a number of changes across the board that will help you get more out of Jest. We are also graduating the custom runners feature out of the experimental stage and added a new package, jest-worker, for parallelizing work across multiple processes. We have compiled a list of highlights below but make sure to check out the (as always) massive changelog.

Jest 20: 💖 Delightful Testing & 🏃🏽 Multi-Project-Runner

A few months ago we announced Jest 19 which came with major new features and was the biggest Jest release until today. Jest 20 has twice the amount of changes compared to the previous version, features a complete rewrite of the test runner, adds new testing APIs. The new release enables a new level of customization and configuration for projects all while making it effortless to upgrade. Beyond Painless JavaScript Testing, we believe Jest is now delivering a Delightful JavaScript Testing experience. Let's take a look at the best new features and changes in depth:

Multi-Project-Runner & Configuration Overhaul#

Until now, Jest could only operate in one project at a time. This is often cumbersome if you are working on many smaller projects that each have their own setup and configuration. With Jest 20, we rewrote the test runner completely to run many projects at the same time within a single instance of Jest, for example if you are working on a React frontend and a node.js backend. Here is a video of Jest running tests for React, Relay, Yarn and Jest all at the same time:

multi-runner

🃏 Jest 19: Immersive Watch Mode & Test Platform Improvements

Today we are pleased to ship version 19 of the Jest testing platform. It's the biggest Jest release we have shipped so far and we are quite excited to show you what we've built over the last two months:

Immersive Watch Mode#

We completely rewrote the watch mode to make it instant and more extensible. As a result, the experience of using it really is immersive: tests re-run instantly after a file change and we made it easy to select the right tests.