8000 GitHub - fijiaaron/testing-with-react
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fijiaaron/testing-with-react

Repository files navigation

Testing with React

To start from scratch

npm create vite

Project name: testing-with-react Select a framework: React Select a variant: Typescript

cd test-with-react npm install npm run dev

add dependencies for Jest, React, etc

npm install typescript ts-node --save-dev npm install jest --save-dev npm install ts-jest @types/jest --save-dev npm install @testing-library/react --save-dev npm install @testing-library/jest-dom --save-dev npm install jest-environment-jsdom --save-dev npm install identity-obj-proxy --save-dev

create jest.config.ts

(see file)

create mock for static files in

test/mocks/fileMock.js

create tests in test filder

test/App.spec.tsx

NOTE: This folder structure with /test/mock and /test seems a bit janky to me. I copied an example but haven't explored how to do it a cleaner way.

Setup "npm test"

Add the following to package.json under "scripts"

"test": "jest"

Run tests

npm test

or

./node_modules/.bin/jest

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0