O'Reilly logo

TypeScript Microservices by Parth Ghiya

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

Mocha

One of the most famous and widely used libraries, Mocha follows behavior-driven development testing. Here, the test describes the use case of any service, and it uses assertions from another library to verify the outcome of the executed code. Mocha is a test runner. It is used t

o organize and run tests through describe and its operators. Mocha provides various features, such as:

  • beforeEach(): It is called once before each spec in describe in the test file from which the test runs
  • afterEach(): It is called once after each spec in describe in the test file
  • before (): This runs code prior to any tests
  • after(): This runs code after all tests have run

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