Share it!

Component and service unit testing is one of the most recurring tasks in professional software development, as this helps to detect bugs, vulnerabilities and unwanted behaviors. When working with JavaScript, be it vanilla JS, NodeJS, React or any other framework, unit test suites are created using tools such as Mocha and Jest.

In Test-driven development, unit tests are written to define expected behavior and then code is crafted to meet this expected behaviour. These tests can be run many times until the code passes all tests.

While running tests may not be a problem when few tests are used, it can be a tedious, time-consuming task when running several test suites, each containing many tests. This can end in a lot of wasted time, as all tests are run, even when only one test is failing.Unit testing with Jest Runner

That’s where Jest Runner becomes a very useful tool. Jest Runner is a VS Code plug-in that enables developers to run a specific test or test suite, directly from the IDE. After installing the plug-in, VS Code will show new commands on test files. A specific test or test suite can be run by clicking on the “Run” command. This way, devs don’t have to run every test suite in order to see if a specific test is working.

Quite a time-saver, ain’t it?


Share it!