Skip to content

DzmitryUr/react-apps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The repository contains code for simple React Apps. Each project was built from scratch during the recording of the YouTube video.

Unit Tests

How to add unit tests to the project

1. Install dependencies

npm install --save-dev vitest @testing-library/react @testing-library/jest-dom jsdom @vitest/coverage-v8

2. Update vite.config.js

test: {
    environment: 'jsdom',
    setupFiles: ['./tests/setup.js'],
    globals: true,
  },

3. Create tests/setup.js

import '@testing-library/jest-dom/vitest';

4. Update scripts section in package.json

    "test": "vitest run",
    "test:watch": "vitest"

5. Update .gitignore by adding coverage

6. Create .spec.jsx or .test.jsx files with unit tests and run test script

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published