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.
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?