<commit_before>---
layout: post
title: "Trying out test commit or revert"
author: "<NAME>"
date: 2019-01-11 14:32:45
tags:
 - JavaScript
 - Programming
 - TDD
---

I stumbled over a new concept the other day. As it was conceived by <NAME>, that inspired and thought me a lot in the past, I got interesting. When I read his [blog post](https://medium.com/@kentbeck_7670/test-commit-revert-870bbd756864) I got to this quote:

> I hated the idea so I had to try it.

I felt the same actually and now I've tried it. I was so provoked by it so I had to try it. 

The idea is pretty simple:

> The full command then is “test && commit \I\I revert”. If the tests fail, then the code goes back to the state where the tests last passed.

In this blog post, I have documented my complete workflow in getting this up and running and trying it out on a simple kata. The post became pretty long but is hopefully easy to follow.

<a name='more'></a>

## The kata, the platform and the workflow

I chose the [Fizz Buzz kata](http://codingdojo.org/kata/FizzBuzz/), because it is so simple that I could focus on the tooling and workflow instead. 

I also chose Node as I'm most comfortable there. 

For this setup, I will not go full "limbo" and run the tests automatically every 2 minutes but rather execute the command manually. 

You can find [my code here](https://github.com/marcusoftnet/fizzbuzz-tcr)

## The initialisation 

Here are the commands I ran to get started:
<commit_msg>Fixed a ugly formatting issue<commit_after>---
layout: post
title: "Trying out test commit or revert"
author: "<NAME>"
date: 2019-01-11 14:32:45
tags:
 - JavaScript
 - Programming
 - TDD
---

I stumbled over a new concept the other day. As it was conceived by <NAME>, that inspired and thought me a lot in the past, I got interesting. When I read his [blog post](https://medium.com/@kentbeck_7670/test-commit-revert-870bbd756864) I got to this quote:

> I hated the idea so I had to try it.

I felt the same actually and now I've tried it. I was so provoked by it so I had to try it. 

The idea is pretty simple:

> The full command then is `test && commit || revert`. If the tests fail, then the code goes back to the state where the tests last passed.

In this blog post, I have documented my complete workflow in getting this up and running and trying it out on a simple kata. The post became pretty long but is hopefully easy to follow.

<a name='more'></a>

## The kata, the platform and the workflow

I chose the [Fizz Buzz kata](http://codingdojo.org/kata/FizzBuzz/), because it is so simple that I could focus on the tooling and workflow instead. 

I also chose Node as I'm most comfortable there. 

For this setup, I will not go full "limbo" and run the tests automatically every 2 minutes but rather execute the command manually. 

You can find [my code here](https://github.com/marcusoftnet/fizzbuzz-tcr)

## The initialisation 

Here are the commands I ran to get started:

{'fraction_non_alphanumeric': 0.07510148849797023, 'fraction_numerical': 0.018944519621109608, 'mean_word_length': 3.716108452950558, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3430312', 'n_tokens_mistral': 921, 'n_tokens_neox': 847, 'n_words': 473}