How to test Socket.io with Jest on backend (Node.js)?

In one of our projects we’ve decided to use Socket.io to handle webscockets and to use a Jest to write BDD/TDD tests. Simply because on frontend we are using Jest too. And we wanted to use one test framework in all project.

This has proven to be a challenge. We cannot find any working example. Documentation did not cover our use case.

So for all of you with this problem I’ve created a boilerplate. I hope it will save you a couple of hours.

IT Architect. FrontEnd Team Lead. #JavaScript on #IoT #UX #Vue.js Fan. I miss having free time, especially for dancing Tango.

IT Architect. FrontEnd Team Lead. #JavaScript on #IoT #UX #Vue.js Fan. I miss having free time, especially for dancing Tango.