How to add Unit Tests to Vite Project? React Unit Testing Tutorial with Testing Library and Vitest
DevWebApp DevWebApp
160 subscribers
68 views
5

 Published On Aug 30, 2024

Learn how to set up unit tests in a ReactJS project created with ViteJS. Step-by-step process of integrating React Testing Library and Vitest into Lyrics Search project

Source code: https://github.com/DzmitryUr/react-ap...
Description in README: https://github.com/DzmitryUr/react-ap...
Lyrics Search Video:    • Create Lyrics Search App in React | R...  

⌚️Timestamps:
0:00 Introduction
0:34 Instalingl dependencies (vitest @testing-library/react)
1:15 Updating vite.config.js
1:37 Creating tests/setup.js
2:17 Updating scripts section in package.json
3:07 Creating .spec.jsx file for unit test
4:40 Adding 'describe' section
6:20 First unit test. Checking that the component renders correctly
8:45 Running unit tests with commands 'vitest run' and 'vitest' watch mode

#ReactJS #Vitest #UnitTesting #TestingLibrary #UnitTests #WebDevelopment

show more

Share/Embed