O'Reilly logo

hapi.js in Action by Matt Harrison

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 10. Testing with Lab, Code, and server.inject()

This chapter covers

  • Writing and running tests with Lab
  • Writing assertions with Code
  • Testing hapi servers
  • Using test spies, stubs, and mocks

Testing is a fundamental practice in the production of quality software, but there are a lot of dogma and strong opinions around testing. Regardless of whether you believe in test-first development or you write all your tests after you’ve finished building features, you should be writing tests.

The hapi contributors themselves are fully committed to testing every line of code they write. All hapi.js core projects are tested to 100% coverage. This 100% rule is enforced by default by hapi’s test runner, called Lab.

Aside from its use in the development ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required