This project is a Component Testing example using JavaScript, React and Cypress.
- NodeJS
- Cypress
- ReactJs
- node >= ^16.x - Node installation
- npm >= ^8.x - NPM installation (or yarn)
Install the dependencies:
npm install
Run application:
npm run start
Run tests in headless mode:
npm run test:headless
Run tests with Cypress GUI:
npm run test
After running the component tests using cypress, you are able to run the tests coverage: (you need to configure the index.html path in your package.json file)
For Windows:
npm run code:coverage
For MacOS
npm run code:coverage:mac
docker-compose build
docker-compose up -d && docker ps && docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' app && docker logs app
echo 'Cypress gonna run!!' && docker ps && docker exec app ls && docker exec app npm run test:headless
echo 'Eslint gonna run!!' && docker exec app npx eslint src/*.js -f json -o ./report/eslint-report.json
docker-compose stop
Feel free to complement/report something in pull requests. The project is ours! ๐ค