Reader small image

You're reading from  Enterprise React Development with UmiJS

Product typeBook
Published inMay 2022
Reading LevelIntermediate
PublisherPackt
ISBN-139781803238968
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Douglas Alves Venancio
Douglas Alves Venancio
author image
Douglas Alves Venancio

Douglas has a background in systems analysis and development, his passion is to help customers and the community solve problems. Over the past few years, he has mainly worked with digital products and innovation, delivering the best user experience with modern web applications.
Read more about Douglas Alves Venancio

Right arrow

Writing tests with Jest

In this section, you'll learn how to write tests using the Jest framework in 
JavaScript projects.

Jest is a fast and reliable test framework for JavaScript projects focusing on simplicity. It works with Babel, TypeScript, Node, React, Angular, Vue, and other tools.

After installing it, we can start using Jest without any extra configuration. In our case, we can write a test and run the test command configured in our project without even installing Jest, as Umi already provides Jest with the umi-test package.

Consider this end-to-end test written with Jest to test the login flow:

it('[END_TO_END] Should sucessfully login', async () => {
  const page = await context.newPage();
  await page.goto('http://localhost:8000');
  await page.waitForNavigation();
  await page.type('#username', 'john@doe.com');
  await page.type('#password', &apos...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Enterprise React Development with UmiJS
Published in: May 2022Publisher: PacktISBN-13: 9781803238968

Author (1)

author image
Douglas Alves Venancio

Douglas has a background in systems analysis and development, his passion is to help customers and the community solve problems. Over the past few years, he has mainly worked with digital products and innovation, delivering the best user experience with modern web applications.
Read more about Douglas Alves Venancio