Summary
In this chapter, we learned about unit testing – what it is and why it is important. Then, we integrated unit testing into our Gatsby site. We also looked at a few different recipes for unit tests that we can use to test different types of react components. We then learned about Git hooks and implemented a Git hook that runs unit tests using husky
. Finally, we investigated core web vitals. We used web vitals to test our page experience both locally using lighthouse, and in the field using the web-vitals
package. Using what you've learned, you should now feel that you can test a site locally, as well as audit its performance, accessibility, and SEO once it is out on the web.
In the next chapter, we will discover how we can add analytics to our site, including how we can track web-vitals
field data.