@nexxspace/campsite v1.0.16
Campsite
The Pitch
Have you ever heard of a Boy Scout Rule that says
"Try and leave this world a little better than you found it."
You can also apply this rule in software development as well. Here is another quote from Uncle Bob:
"Always leave the code you're editing a little better than you found it."
Then you might ask question, How do I know when I am editing the code if I have made it better or worse?
Have we made our test coverage better or have we made it worse than before?
Campsite can show you exactly that. It compares your unit test coverage against a baseline ("code when you found it"). It then gives you a concise report of areas of improvement and mess that we are leaving behind.
Installation
Lets install campsite
globally.
npm install @nexxspace/campsite jest
How it works
Before you make any changes in the code. Evaluate the test coverage of current code and form a baseline. To do that, run the following command in your project.
$ campsite --baseline
This in addition to running all unit tests, it also creates a baseline file capturing the
jest
coverage statistics.Now change your code. Don't forget to add some unit tests :)
Now, lets compare it against the baseline we saved earlier in (1), by running the following command.
$ campsite
This produces a report that looks something like this:
campsite shows us the areas we:
- made some improvements. The "+" (in green)
- made it worse. The "-" (in red) .