From the course: Learning End-to-End Testing with Jest

Unlock this course with a free trial

Join today to access over 25,600 courses taught by industry experts.

Run test automatically

Run test automatically

- [Instructor] It's possible to forget linting your code, and running your tests before pushing code to production. To prevent this and ensure boggy code do not find their way to your code base, you need Git hooks. Git hooks are custom scripts that git execute before or after events such as commit, push, rebase, amongst many others. For this course, we will use an NPM package called pre-push to automatically run our tests and lint our code before pushing to remote. It will refuse to push and return error if any error occurs with linting or testing our code. It is important to know that you can write your own custom git hook scripts, if you do not want to use this package. Every git repository has a dot git slash hooks folder with an example script for each hook. Because they are example files, they have the dot sample extension, but you can rename them by removing the dot sample and editing them as necessary. Git will always…

Contents