Jon Combe logo

Text2Jest: JavaScript Jest tests done in a jiffy!

April 202310 months ago

Jest is a JavaScript Testing Framework. With my work being very front-end focused over recent years, I've spent a lot of time using it. That's a lot of tests.

Rather than just jump in and write each test one by one, I prefer to plan the structure of what I going to do first. I make a list of all tests I am going to put write, organise them into sensible groups, and put them in an order which is hopefully easy to read and understand for the next developer who comes along after me.

A screenshot of Text2Jest in action

As good as having this plan was, I found it tedious to take this markdown-style list of bullet points, and type it all out into thedescribe() and test() functions that Jest understands. If only I had something that could do this all for me.

A screenshot of the Text2Jest configuration options

And so Text2Jest was born: it takes your (optionally nested) to-do list structure and instantly outputs the structure of the code for you, saving some time and freeing the brain to concentrate on the task at hand. There is quite extensive documentation to get you started plus there are some configuration options which may make your life easier too.

Your settings and most recent edit are stored in localStorage so you don't lose your work if you accidentally close the browser tab.

I find Text2Jest helpful and use it all the time. It would be great if it helps you too.