concept test - drive development in category javascript

This is an excerpt from Manning's book Testing JavaScript Applications.
Then, I’ll give you an overview of the tools available in React’s testing ecosystem, focusing on my library of choice:
react-testing-library, which I’ll use to show you how to write your first tests for React applications.Even though I’ll focus on a single library, I’ll explain how many other libraries work, their pros and cons, and what to consider when choosing tools so that you can make your own decisions depending on the project on which you’re working.
To understand how to test a React application, you must learn what’s necessary to make it run in a browser. Only then you’ll be able to replicate the browser’s environment within your tests accurately.
In this sub-section, you’ll learn how to configure a React application for it to run in a browser. During the process, I’ll explain what tools you’ll need, and what each one of them does.
Start by creating an
index.htmlcontaining a node into which you’ll render your application. This file should also load a script calledbundle.js, which will include your application’s JavaScript code.