Integration Tests with a Local Git Server
When you’re writing tests for your application, you need to ensure that the tests run on a reproducible environment, to guarantee that the results match the expected values. This is a challenge when executing external commands that modify the state of an external resource, as the test conditions will be different the second time you execute the tests. The first strategy you’ll apply to handle this issue involves instantiating a local Git server by using a test helper function, similarly to what you did in Testing with the Help of Test Helpers.
The test helper function setupGit uses the git command to create a Bare Git repository that works like an external Git service such as GitLab or GitHub. A bare ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access