Closed cross20 closed 1 year ago
Also, use the React guide for running tests to set up unit testing.
GitHub Actions need to be set up to ensure tests pass before merging into the main branch.
Creating new branch 18-set-up-unit-testing-fix-infinite-test to address an issue where unit tests run indefinitely in GitHub actions. The issue occurs because the --watch flag is being used when running tests, which requests user input.
To prevent infinite tests, but also allow local tests to continue running in watch mode, the GitHub actions script directly runs npx jest
rather than running the test
script defined in the package.json file.
Unit testing should be set up so to ensure the project works before it is deployed. To set it up, see this guide on unit testing with Jest/React/Next.