What is the best testing framework to use with Node.js?


Question

I have looked at the rather long list of testing frameworks at https://github.com/ry/node/wiki/modules#testing. What is the experience with these frameworks?

Obviously the ability to run in the browser would be a big bonus, but I'm mainly interested in Node.js. Something with a heavily asynchronous slant would be great.

1
128
7/17/2015 7:44:38 PM

Update:

Mocha is the best in my opinion.


What is the experience with these frameworks?

I played with expresso which is pretty cool testing framework which also has test-coverage. It has been created by TJ Holowaychuk who is also the creator of Express.js (insanely fast (and small) server-side JavaScript web development framework built on Node.js and Connect). I recently saw that he also has a cool library called should.js which can be used together with Expresso for a even better testing experience.

Obviously, the ability to run in the browser would be a big bonus

I don't believe it can run in the browser, but I also don't get why you would want to run it inside the browser?

but I'm mainly interested in Node.js. Something with a heavily asynchronous slant would be great.

Quote from the expresso:

The argument passed to each callback is beforeExit, which is typically used to assert that callbacks have been invoked.

You can use beforeExit to test asynchronous functions.


TIP: Follow TJ Holowaychuk on GitHub, because he creates very good open-source code.

67
4/17/2019 8:03:32 AM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon