This project is configured with GitHub Actions to run tests automatically on pull requests and pushes to the main branch.
The test workflow (test.yml) does the following:
- Runs on every push to
mainand on every pull request tomain - Sets up Node.js
- Installs dependencies
- Runs tests with
npm test - Uploads test results as artifacts
To make passing tests a requirement for merging pull requests:
- Go to your GitHub repository
- Click on "Settings"
- Click on "Branches" in the left sidebar
- Under "Branch protection rules", click "Add rule"
- In "Branch name pattern", enter
main - Check "Require status checks to pass before merging"
- In the search box, search for and select "Tests / test" (the workflow/job name)
- Optionally, check other protections you want:
- "Require pull request reviews before merging"
- "Require signed commits"
- Click "Create" or "Save changes"
After setting up these rules, pull requests cannot be merged into the main branch unless the tests pass.
- Run tests once:
npm test - Run tests in watch mode:
npm run test:watch