11 ways to improve code review process

Regardless of the team size, before any code can be merged to the version control system it should be reviewed. It's a great way to communicate, improve the code and share knowledge across the team.

Here is my subjective list of things you can do to improve that process.

3. Making assertions with Chai

Why Chai?

As mentioned in the structure, a test case goes red when anything in the it block throws an exception. First of all, by calling a function in specs we expect that it has been executed without any error. If the code seems to be pretty simple and writing specs for it sounds like a waste of time, it's still worth to have them, at least for this information.

2. The structure of a mocha test

As I said in the introduction you can select one of the various available interfaces. My favourite is BDD and this is the interface I'm going to present here. The main goal of this interface is to help you write specs as grammatically correct sentences.

1. An idea around specs

My intention is to create a practical guide to writing specs. More important than knowing how is knowing why to write specs.

Introduction to the BDD c(o)urse

As I wrote in the I do not write tests article, my favourite testing stack is Mocha with Sinon and Chai. Why? Each of the libraries is focused on a specific problem, they are highly customizable and their big community provides many add-ons and integrations. This makes them a truly universal stack.

I do not write tests

and i'm proud of it.

I've spent plenty years on coding, invested a lot of time in developing products, wrote thousands of lines of code and all that without writing a single unit test. I felt skilful, productive and effective at my job. Of course I made many mistakes, but as long as they were easy to fix I treated them as a side effect of my work.