Where did we come from to JavaScript testing?

I should write a code to test the code I just wrote, do I? Credit: Ben White @ Unsplash

While considering renewing the service pages of Hurriyet.com.tr in May, an opportunity has been born to go for a change on the structure that we use on the side of front-end. The first benefit of it is to being that renewing the libraries such as Bootstrap. The second one is to being that making easier to passing into the modular structure on the side of JavaScript.

To write the JavaScript in modular, it was enough to removing the BabelJS on the build step in the Gulp and instead adding the Webpack with a little arrangement. But if there is going to be change in this structure, why not recovering the old inadequacies? In the error fixing tasks that I have done before I felt the lack of the comment lines too much. How it could be if we standardize it in this project? How could it be even going a step ahead and transforming the comments into documentations with such tool like JSDoc?

While searching the plus/minus of comment and documentation I remember that the job to do in here wasn’t included to the project deadline. If the tool that I am going to use would bring up a problem to me and if I waste extra time to solve it, this situation would be an obstacle to deliver the work. The limited time turns into single shot bullet in here. Should waste it to the setup of the documentation tool? Or to the writing of integration test?

Tests are executable documentation.

So the topic of writing JavaScript tests has came up in this point. As a matter of fact encouragement of the unit test writing on the side of backend made thought doing it on the side of frontend is prefencial as well. That’s why integration test passed a step ahead . (Why not unit test? That a topic of another article…)

I saw that the Jest submits the optimal solutions after trying few test tools. The biggest factor in here is easy handling and simple configuration of it.

I have a mind to share the experience I had about js test tools in here. Yet it has already been written by Vitali Zaidman in his article ‘An Overview of JavaScript Testing 2018’ in a detailed way. If you interested, I recommend to read that article.

In my first in-firm BBS I was telling writing a JavaScript tests isn’t that bad. (Actually, it is!)

This week I made my first in-firm BBS. I gave examples about why JS needs tests and testing methods, lastly handling Jest and its configuration. You can see the presentation I have done below. (Its half Turkish half English, sorry about that.)