Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Full Stack Development with Spring Boot 3 and React

You're reading from   Full Stack Development with Spring Boot 3 and React Build modern web applications using the power of Java, React, and TypeScript

Arrow left icon
Product type Paperback
Published in Oct 2023
Publisher Packt
ISBN-13 9781805122463
Length 454 pages
Edition 4th Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Juha Hinkula Juha Hinkula
Author Profile Icon Juha Hinkula
Juha Hinkula
Arrow right icon
View More author details
Toc

Table of Contents (23) Chapters Close

Preface 1. Part I: Backend Programming with Spring Boot
2. Setting Up the Environment and Tools – Backend FREE CHAPTER 3. Understanding Dependency Injection 4. Using JPA to Create and Access a Database 5. Creating a RESTful Web Service with Spring Boot 6. Securing Your Backend 7. Testing Your Backend 8. Part II: Frontend Programming with React
9. Setting Up the Environment and Tools – Frontend 10. Getting Started with React 11. Introduction to TypeScript 12. Consuming the REST API with React 13. Useful Third-Party Components for React 14. Part III: Full Stack Development
15. Setting Up the Frontend for Our Spring Boot RESTful Web Service 16. Adding CRUD Functionalities 17. Styling the Frontend with MUI 18. Testing React Apps 19. Securing Your Application 20. Deploying Your Application 21. Other Books You May Enjoy
22. Index

Using Vitest

Vitest (https://vitest.dev/) is the testing framework for Vite projects. It is also possible to use Jest in Vite projects, and there are libraries that provide Vite integration for Jest (for example, https://github.com/sodatea/vite-jest). In this book, we will use Vitest because it is easier to start using it with Vite. Vitest is similar to Jest, and it provides test, describe, and expect, which we learned about in the Jest section.

In this section, we will create tests with Vitest and the React Testing Library for the frontend project that we used in Chapter 14, Styling the Frontend with MUI.

Installing and configuring

The first step is installing Vitest and the React Testing Library to our project:

  1. Open the project in Visual Studio Code. Move to your project folder in the terminal and execute the following npm command inside your project folder:
    npm install -D vitest @testing-library/react @testing-library/jest-
      dom jsdom
    

    The -D...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime