Cucumber.js or Mocha?

Which is better? Cucumber.js or Mocha? There is no clear answer to this question, but here is my advice: if you have engaged stakeholders who are willing to read or even write the Gherkin code, go for Cucumber.js. If you are not in this (fortunate) situation, then using Cucumber.js is not so attractive.

Even if you are in this situation, you need to think twice before using Cucumber.js, specially if you are new to BDD or JS. The main problem with Cucumber.js is that you need to invest a lot in the test support code that translates the Gherkin to real code. This effort is wasted if the stakeholders are not going to, at least, read the Gherkin code and give you feedback on the intended behavior of the system.

On the technical ...

Get Learning Behavior-driven Development with JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.