Starting...
This lab is to help our codes to make sure working well. Instead of manual testing for our functions, there are a lot of automatic test framwork for any languages. Since I used node js for my application, I chose jest since it looked very convenient and easy for me.
Progressing...
Jest, link, is great test frame work since it provides more than mocha and I heard it is maintained by facebook... but not sure. To use this, I installed it as a development package and simply put some scripts such as test and test:coverage.
To be honest, for me it was not really easy as what I have heard. I need to understand the mocking function or fake implementation which made me so confused when I met it at first such as jest.fn() and mockImplementation().
To be honest, I am not a fan of test cases yet, I really have no idea for some parts how to test maybe I need more time to be familiar with it. Moreover, I think I should have not implemented the current way like a lot of features in the same function and there is no return value. Instead, I used just console log, which made me so stressed and I needed to spend a lot of time for it.
My code coverage is actually not high but it was my first time to write test cases so I am satisfied with my cases.
Next, I set CI, Continuous Integration for check any things needed. Previously as an owner, I needed to check the code and decide the modification would be accepted. But, now, those of tasks will be done by CI automatically. To activate it we need to refer this site.
Finally, The configuration file is very straight-forward. Like above, just add commands by orders. Then it will always check the correctness of any new codes added. Most of node-js projects' configuration file look very similar and it is really great since it provides various OS environment.
Comments
Post a Comment