Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why test in continuous integration if you can test on pre-commit and pre-push git hooks?

What is the point of using a Continuous Integration system to test your code if you already have a system like Husky running that allows you to test you code before pre-commit and pre-push?

like image 298
Rick Bross Avatar asked Apr 24 '18 06:04

Rick Bross


2 Answers

Pre-commit and pre-push hooks are great for quick operations and tests. Sometimes you can even setup a hook in your IDE that will run quick unit tests every time you save a file. But usually you have multiple suites of tests and unlike unit tests functional, integration and performance tests often take longer time to run, which is not feasible for hooks.

Also, you want to run your tests in the same environment where you build your deliverables, which is usually not your local machine.

Another reason to use CI system is to run post-merge tests to verify that there are no issues introduced by multiple parallel merges.

All-in-all, the more tests you run, the better and a CI system allows you to run both pre-merge tests usually triggered by some sort of pull request hook and post-merge tests. And all of that in a controlled reliable environment.

like image 119
Nikita Makarov Avatar answered Sep 27 '22 20:09

Nikita Makarov


I'm not really interested about whether it passes in your local environment, where you may have a different version of some dependent library on your environment path. I want to know for sure that anyone's contributions don't break the software when linked against the specific library versions that we ship with.

like image 24
Adam G Avatar answered Sep 27 '22 21:09

Adam G