Comparison between the `lab` and` code` vs `mocha` and` chai` nodejs libraries

I am new to node.js and I decided that I would use hapijs for my implementations on the Internet and the API.

However, I found that the hapi community built and used lab and code for test and statement libraries, which are the correspondence of mocha and chai .

It’s hard for me to find the differences between these libraries.

I know that it is possible to use them all interchangeably, but I would like to get a more detailed comparison, because I want to define and adhere to coding standards, and I don’t like mixing and matching libraries, unless there is a good reason,

Any feedback is appreciated

+5
source share
1 answer

When you plan to build a web application using nodejs, Hapi is more suitable for it. Writing a TTD is important for the developer now. Lab and code is a node structure that helps you write unit tests in nodejs. The lab comes with Hapi to cover a single case for an endpoint, for example, to write a test case for a route, and for different scenarios for a route. Code is a statement library. The code is used if you approve the response code, the response body, and any header parameters.

0
source

Source: https://habr.com/ru/post/1237271/


All Articles