DEV Community

Cover image for Write Jest tests faster in VS Code with this extension
Giulio Dellorbo
Giulio Dellorbo

Posted on • Edited on

Write Jest tests faster in VS Code with this extension

Hey there!

I’ve just released the VS Code extension for jest-test-gen, this is the fastest way to get an initial unit test file with boilerplate code in one click, directly from your favorite IDE.

To try it out simply use the link to install the extension:

https://marketplace.visualstudio.com/items?itemName=com-egm0121.vs-jest-test-gen

or just search for “jest test gen” inside the extension search bar in VS Code.

This will add a new command called “Generate Jest tests” to your command palette.

To use it simply open a (js| ts | tsx ) file in VS Code and then run the “Generate Jest tests” command and the generate unit test file will be written next to your source file and opened in the editor for you.

It supports code generation for the following exports:

  • Typescript typed React class && functional components
  • React class && functional components
  • ES6 Classes
  • Named functions and arrow functions
  • POJOs with methods

Try it out and let me know your feedback! 😃

For any issue found with the generated code, file an Issue on the jest-test-gen repo: https://github.com/egm0121/jest-test-gen

If you find this useful, please ⭐️ the project on GitHub.

Happy Coding!

Top comments (0)