As I mentioned in my last blog post I am going to be testing my fairly big JavaScript application which is built with the Express web server framework. As with most things related to coding, there are lots of ways to go about testing your web application. The most sensible thing to do is use a testing framework or library, instead of writing them in vanilla JS which would take forever! A few that come to mind are Mocha, Chai, Jasmine and Jest (which I learnt about today). Jest is a testing suite for JavaScript applications, created by Facebook, and is the one I’ll be using. You can learn more at

In addition to the above, there are many different types of tests I’ve heard of so far – end-to-end, logic, page, cross-page, link checking, integration, unit, etc. I’m no expert but I think unit testing is the way to go.

My journey started with Jasmine as the testing suite because that is the test suite you use on However, I had also read about Mocha and Chai together. Now I know Chai is not a test framework but rather a helpful library that can be integrated with a test framework of your choice. So this is definitely something I’ll be looking more into. My journey has now led me to use Jest because after lots of searching and asking questions, I never really found any good resources on how to unit test an Express app with Jasmine.

Most of the tutorials or blog posts I watched/read required that you ‘set up and teardown’ your express server before each and after each test. After running into lots of errors I decided to try a new framework – Jest, which was suggested by @zachcodes (a 10x software dev). When I found out it was Facebook’s test suite (which they use to test Facebook, obviously), I was certain it made sense. Anyway, I created a quick Gist on Github of how my test suite has begun (oh and it works! yay!)