JavaScript development - When do I need to start unit tests?

I started writing a JavaScript application as a personal project. I hope to learn and use unit testing for this project. I don't have much experience writing unit tests, but I read that Jasmine will be a good library to help me with this.

With that said, I was a little overdoing it in my original coding booklet. I had an idea and ran with it. Thus, the structure of my application was and remains not as OO as I would prefer. This led me to the paths of many large refactors. I found that refactoring in a weakly typed language leaves me particularly error-prone.

The fact that I have to go back and correct the errors that I re-entered makes me crave for unit tests. On the contrary, however, the fact that I am reworking the core of my code base still makes me hesitate. I do not want to create unit tests for my project, in order to later decide that more restructuring will be needed (which will depreciate my tests after "fixing the error").

Is this a common problem? I feel that there will be a moment when my “foundation” will be stable enough to write tests for him ... but it makes the tests sound much less attractive.

+5
source share
1 answer

"" "prototype" - , , .

, , .

: , . , , , .

, , - . , , . , , , - .

, , OO, . ( ) , TDD.

, . , , . , Selenium.

TDD , , . , , , .

+4

All Articles