Aller au contenu principal

Jest 22 : Améliorations & exécuteurs personnalisés

· 8 minutes de lecture

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 : 💖 Tests agréables & 🏃🏽 exécuteur multi-projets

· 7 minutes de lecture

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:


🃏 Jest 19 : Mode de surveillance immersif & améliorations de la plateforme de test

· 7 minutes de lecture

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.

Une grande expérience pour les développeurs

· 3 minutes de lecture

Nous croyons fermement que la grande documentation est cruciale pour fournir une grande expérience de développeur. Les docs doivent être clairs, concis, et utiles pour les nouveaux utilisateurs et les vétérans. Dans cet esprit, nous avons récemment pris un certain temps pour réviser le site Web de Jest.

Docs améliorés

Une des modifications que vous remarquerez lors de la visite de notre documentation est la barre latérale mise à jour. La documentation est maintenant divisée en trois domaines principaux : une introduction à Jest, des guides détaillés sur les fonctionnalités de Jest et une référence complète à l'API.

La section Introduction vous guidera depuis l'installation de Jest et l'écriture de votre premier cas, jusqu'à l'utilisation des matchers de Jest et le test du code asynchrone. Si vous êtes nouveau chez Jest ou si vous avez besoin d'une mise à jour rapide, ces docs devraient vous aider à accélérer en un rien de temps. Si vous avez déjà utilisé Jest et que vous n'avez besoin que d'une référence rapide sur la façon dont il est installé, vous ne devez pas aller plus loin que le guide Pour commencer.

Une fois que vous vous sentez à l'aise en utilisant Jest, passez à la section avancée Guides. Le nouveau Guide de test d'instantané couvre tout ce que vous devez savoir sur la création et la maintenance de cas de tests instantanés.

Enfin, nous avons complètement remanié notre documentation de référence de l'API. Vous pouvez maintenant trouver des informations détaillées sur tous les Globalsde Jest, correspondants, et chaque drapeau supporté par jest CLI.

2016 dans Jest

· 8 minutes de lecture

2016 a été une grande année pour les tests JavaScript avec Jest. Au cours des six premiers mois de l'année, nous avons réécrit Jest et construit une base solide pour améliorer de manière significative les performances et l'expérience des développeurs lors des tests du code JavaScript. We flow-typed the entire codebase, built a ton of integration tests for Jest itself and adopted lerna to turn Jest from a framework into a Painless JavaScript Testing platform.

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.

Jest 16.0: Turbocharged CLI & Community Update

· 6 minutes de lecture

It's been one month since the last major release and we've made significant improvements to Jest since. In this major release we are updating the snapshot format we are using which will likely require snapshots to be updated when upgrading Jest. We don't make these changes lightly and don't expect this to happen often but we think it is necessary to improve the format from time to time.

Upgraded CLI


Jest 16 features a new reporter interface that shows running tests as well as a live summary and a progress bar based on the estimated test runtime from previous test runs. We also improved the CLI output to work better with different color schemes. If there were test failures in a previous run, Jest will now always run those tests first to give useful signal to users as quickly as possible.

Jest 15.0 : Nouvelles valeurs par défaut pour Jest

· 8 minutes de lecture

We spent the past year making Jest faster, easier to configure, added tons of features and built snapshot testing. However, there were two areas where we invested very little: the CLI output and user experience. With Jest 15 we are changing the framework radically to make it easier to use both for beginners and experienced users. We are excited that our investment in Jest is now paying off: we can move fast and improve the framework for Facebook and the open source community at light-speed. Jest's goal is to come with batteries included and to require as little configuration as necessary. We recently got a chance to explain our philosophy on a create-react-app issue.

The most important change to talk about is a set of new defaults. If you are an existing Jest user you will very likely need to update your configuration for Jest 15. In most cases it will simplify your setup and Jest will provide useful error messages during the upgrade. All of the new defaults can be disabled to suit your needs, but we still consider the disabled features critical for Jest in certain situations and will continue to use and support them at Facebook long-term. Our API documentation was also completely rewritten to reflect these changes. This pull request for React highlights some of the changes necessary for existing projects.

Jest 14.0 : Test de snapshot de l'arborescence React

· 6 minutes de lecture

One of Jest's philosophies is to provide an integrated “zero-configuration” experience. We want to make it as frictionless as possible to write good tests that are useful. We observed that when engineers are provided with ready-to-use tools, they end up writing more tests, which in turn results in stable and healthy code bases.

One of the big open questions was how to write React tests efficiently. There are plenty of tools such as ReactTestUtils and enzyme. Both of these tools are great and are actively being used. However engineers frequently told us that they spend more time writing a test than the component itself. As a result many people stopped writing tests altogether which eventually led to instabilities. Engineers told us all they wanted was to make sure their components don't change unexpectedly.

Jest 13.0: Flow & REPL

· 3 minutes de lecture

Today we are happy to announce the next major release of Jest. We have made major changes to Jest which are going to benefit you and all of Facebook's JavaScript test infrastructure. Most importantly, we added static types to all of Jest's code during a recent Jest hackathon at Facebook. Fifteen people worked for a day and night to add Flow types to Jest and to add new features to Jest. The Flow types serve two purposes: First, we believe that code is written to be read. Most of the time, code is written only once but read by dozens of people over the course of years. Adding static types to the project helps document the code and helps explain some of the architecture in Jest. Second, adding static types makes maintenance easier and will allow us to more confidently refactor parts of Jest without fear of breakages.

The Flow project has evolved a lot within Facebook and has been successfully adopted across many of our frameworks and almost all of our product code. Adoption can be parallelized incredibly well – it can be done file-by-file until enough of the codebase is well-typed. Then, Flow provides real value and helps guide through large changes. Through this, many small edge cases and bugs were found.

Jest 11.0

· 5 minutes de lecture

Aujourd'hui, nous annonçons un passage à la version majeure de Jest avec Jest 11.0 comme première version majeure. Jest a été utilisé par les ingénieurs de Facebook et sur nos systèmes d’intégration continue depuis des années et nous pensons que Jest a été bien plus qu’un “1. » pour une longue période. Ceci est similaire à un changement l'équipe React a fait.

Si vous utilisez Jest 0.9 ou Jest 0.10, la mise à jour devrait être transparente. Tous les changements de ces derniers mois ont été introduits dans Jest 11.0.

New in Jest 11.0

Intégration de Babel et configuration simplifiée

babel-jest was adopted within the newly modularized Jest repository and it is now seamlessly integrated into Jest. Si vous effectuez une mise à jour depuis une ancienne version de Jest ou si vous souhaitez adopter Jest, Nous vous recommandons de lire le guide pour commencer.