Abhishek-Mallick/universal-box

[TEMPLATE] - Jest + React | TDD

Open

#156 opened on Oct 19, 2024

 (0 comments) (0 reactions) (0 assignees)JavaScript (41 forks)auto 404
hacktoberfest

Repository metrics

Stars
 (49 stars)
PR merge metrics
 (PR metrics pending)

Description

What domain will the project template be based on?

Others (please specify in the details)

If 'Others', please specify the preferred domain.

Testing-TDD

Particular directory path for the template.

templates/Testing-TDD/Jest-React-Testing-Library/

What tech stacks do you want to include?

React, Jest, React Testing Library, Babel, Webpack

Brief Description

This template offers a complete setup for unit and integration testing in a React application. It includes sample tests for components, hooks, and context, along with configuration files to ensure your testing environment is ready to go. The setup also demonstrates how to mock API calls and manage asynchronous code.

Key Features:

  1. Testing Configuration: Pre-configured Jest and Babel settings for ES6+ support.
  2. Sample Components: Include a variety of React components (functional, class-based) for testing.
  3. Test Examples: Provide example tests covering rendering, user interactions, and state changes.
  4. Mocking: Demonstrate how to mock external modules and API requests.
  5. Code Coverage: Generate code coverage reports and enforce coverage thresholds.
  6. Continuous Integration: Include configuration for running tests in a CI environment (e.g., GitHub Actions).

Ideal Workflow:

  • Develop sample React components and ensure they are well-documented.
  • Write comprehensive tests using React Testing Library and Jest.
  • Configure scripts in package.json for running tests and generating coverage reports.
  • Update the README with instructions on how to run tests and interpret results.
  • Ensure compatibility with the latest versions of React and Jest.
  • Optionally, include examples of testing custom hooks and context providers.
  • Create a corresponding markdown for populating docs in website/content/Templates/Testing-TDD/Jest-React-Testing-Library.md .. refer to this one for getting an idea on the format to follow

👀 Have you spent some time checking if this issue has been raised before?

  • Yes
  • No

🏢 Have you read the Code of Conduct?

Would you like to work on this issue?

No

Contributor guide