Welcome to my React testing repository! This repository is a comprehensive collection of all my learning and practice related to testing React applications using Vitest and jsDOM.
Before you start, make sure you have the following installed:
-
Clone the repository:
git clone https://github.com/Anubhav-dev-web/ReactTesting.git cd ReactTesting
-
Install dependencies:
npm install # or yarn install
-
Run the tests:
npm run test # or yarn test
Vitest is a blazing fast unit test framework powered by Vite. Here, you will learn how to set up Vitest for testing React components.
Learn how to write tests for your React components, including unit tests and integration tests.
Understand how to mock and stub dependencies in your tests to isolate components and test their behavior independently.
Learn how to use jsDOM to simulate a browser environment for testing React components that interact with the DOM.
- Basic Component Test
- Testing Props and State
- Mocking Functions
- DOM Manipulation Test
Contributions are welcome! If you have any improvements or new concepts to add, please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Commit your changes (
git commit -m 'Add new feature'
). - Push to the branch (
git push origin feature-branch
). - Open a pull request.