FelipeOliveiraDvP / testing-react-app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vite React App

This is a simple Vite-powered React application. It comes pre-configured with Jest for running tests.

Getting Started

  1. Clone the repository:
git clone https://github.com/your-username/your-vite-react-app.git
cd your-vite-react-app
  1. Install the dependencies
npm install
  1. Run the development server
npm run dev

Running Tests

On the project root, run the following command:

npm run test

Writing Tests

All test files should be placed in the src/__tests__ directory. Jest will automatically discover and run these tests.

To create a new test file, follow this naming convention: filename.test.js or filename.spec.js.

Example test file:

// src/__tests__/example.test.js

import { sum } from "../utils";

test("adds 1 + 2 to equal 3", () => {
  expect(sum(1, 2)).toBe(3);
});

For more information on writing tests with Jest, refer to the Jest documentation.

About


Languages

Language:TypeScript 51.6%Language:CSS 22.6%Language:JavaScript 15.0%Language:HTML 10.8%