Skip to content

Anubhav-dev-web/ReactTesting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

🌟 React Testing with Vitest and jsDOM

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.

📋 Table of Contents

  1. Getting Started
  2. Project Structure
  3. Learning Concepts
  4. Example Tests
  5. Resources
  6. Contributing
  7. License

🚀 Getting Started

Prerequisites

Before you start, make sure you have the following installed:

Installation

  1. Clone the repository:

    git clone https://github.com/Anubhav-dev-web/ReactTesting.git
    cd ReactTesting
  2. Install dependencies:

    npm install
    # or
    yarn install
  3. Run the tests:

    npm run test
    # or
    yarn test

📘 Learning Concepts

Setting Up Vitest

Vitest is a blazing fast unit test framework powered by Vite. Here, you will learn how to set up Vitest for testing React components.

Writing Tests

Learn how to write tests for your React components, including unit tests and integration tests.

Mocking and Stubbing

Understand how to mock and stub dependencies in your tests to isolate components and test their behavior independently.

Integration with jsDOM

Learn how to use jsDOM to simulate a browser environment for testing React components that interact with the DOM.

📂 Example Tests

  • Basic Component Test
  • Testing Props and State
  • Mocking Functions
  • DOM Manipulation Test

📚 Resources

🤝 Contributing

Contributions are welcome! If you have any improvements or new concepts to add, please follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Commit your changes (git commit -m 'Add new feature').
  4. Push to the branch (git push origin feature-branch).
  5. Open a pull request.

About

React testing using React testing library and vitest

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published