7

I am new to node.js and I have decided that I will be using hapijs for my web and API implementations.

However, I have found that the hapi community built and use lab and code for the test and assertion libraries, which are a rewrite of mocha and chai.

I am having a hard time finding the differences between those libraries.

I know there is the possibility of using them all interchangeably but I would like a more detailed comparison, as I want to define and adhere coding standards and I don't like mix and match of libraries, unless there is a valid reason.

Any feedback is appreciated

agarcian
  • 3,909
  • 3
  • 33
  • 55
  • 1
    I found Lab quite stiff. It does the job but you have to stick to Lab runner to run tests, and Lab rigs are cumbersome (Lab requires spec files to export `Lab.script()`). When spec modules are abstracted properly from Lab, Lab can be swapped to Mocha at any time with minimal changes, I guess. – Estus Flask Dec 02 '15 at 18:59
  • 1
    The reason for forking and differences are explained in the README: https://github.com/hapijs/code#acknowledgments – Matt Harrison Dec 04 '15 at 15:07

1 Answers1

0

When you are planning to build web application using nodejs Hapi is more suitable for it. Writing TTD is important for developer now a days. Lab and code is node framework to help to writing unit test in nodejs. Lab comes with Hapi to cover unit case for endpoint like writing test case for route and covering different scenarios for route. Code is an assertion library. Code is used if you are asserting response code ,response body and any header parameters.

Vishnu Dubey
  • 141
  • 1
  • 3
  • 10