Note 💡: Husky will run test scripts before each commit. If tests fail, the commit will be discarded.
Note 💡: Husky runs
npm run test:stagedwhich will run tests without watch mode. If we'd putnpm testinside.husky/pre-commitfile, it would get stuck forever in watch mode.
- Install packages:
npm i - Run App:
npm start - Run Tests in watch mode:
npm test - Run Tests in CI/CD mode (without watch mode):
- For pre-commit:
npm run test:staged👉 Will run tests for only those files that have changed since last commit - For CI/CD (CircleCI):
npm run test:staged_all👉 Will run all tests
- For pre-commit:
- Update Snapshots through terminal:
npm test -- --updateSnapshot - Update Snapshots when in watch mode: Just hit
ukey when in watch mode