Switching from Ava to Jest for TypeScript

The Why and How I switched my testing framework

Why:

You might love Ava as a testing framework. We know we did! We still kind of do. It’s an ache that we won’t soon forget, but in the wacky world of JavaScript, things change every day. We need a way to change quickly with it.

The change started with us. We fell in love with TypeScript. I’m not sure if you’ve taken a moment to really give TypeScript a candid investigative prod, I recommend this video if you haven’t had the pleasure, but TypeScript is part of what we use hand-in-hand with testing to ensure a stable product.

The real benefit comes from the integration into our editor! Instant red-line when we’d have an error that would crash; what a time-saver!

That’s when the change started. We needed tools who were willing to play along with our tools. New passions need to be fed.

Over a year ago, someone tried to blaze the trail for TypeScript and Ava. This epic Github issue ensued.

Fast forward to current day; I’m working on Solidarity with testing in Ava. I decided (after consulting with Steve Kellock) the project should be converted over to TypeScript. Faced with no great way to really understand my Ava test coverage, it seemed like it was time to make a game plan and do the swap to Jest. In Jest, I could move to 100% TypeScript on TypeScript testing, with coverage reporting that would be accurate.

UPDATE: Since this article was written — ava-ts is now a thing. Please give it a try or star the repo! The rest of this article is how easy it was to switch to Jest (if that’s what you feel you need to do).

How:

Here are the game plan objectives: