website/blog/2016-06-22-jest-13.md
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.
<!--truncate-->With the help of lerna, we continued to modularize the Jest project. With just a small update to the configuration, Flow and lerna now get along well with each other. Splitting up Jest into packages helped us rethink module boundaries and enabled us to ship useful packages standalone: The jest-runtime and jest-repl cli tools now allow you to run scripts in a sandboxed Jest environment, enabling you to run and debug your app from the command line. This is especially helpful for projects that use Facebook's @providesModule module convention. To get started, just install jest-repl and run it in the same folder you normally run your tests in! We also published a jest-changed-files package that finds changed files in version control for either git or hg, a common thing in developer tools.
--notify.browser config option to properly resolve npm packages with a browser field in package.json if you are writing tests for client side apps.jest.isMockFunction(jest.fn()) to test for mock functions.jest.mock('Module', implementation, {virtual: true})..haste_cache folder. Jest now uses the operating system's preferred temporary file location.Finally, we have received a complete website redesign done by Matthew Johnston and added documentation for using Jest with webpack. Happy Jesting!