![]() Open the Jest run/debug configuration that you created earlier and add -watchAll to the Jest options field, save the configuration, and then run it again. By default, WebStorm disables watch mode when running all tests, but you can enable it easily. In this mode, tests will be restarted automatically as soon as you make any changes to them or to any related files. ![]() One of Jest’s greatest features is its watch mode for running tests. If you have implemented a fix for the failed tests and now want to run them again to check the fix, click the Rerun Failed Tests button in the tool window. If you want to run the whole test file with Jest, right-click it and select Run in the context menu that opens. You can modify it by going to Run | Edit Configurations in the main menu and clicking on Edit configuration templates. The IDE will use the predefined template for Jest run/debug configurations. When you run a test this way, WebStorm creates a new run/debug configuration specifically for it. If you click it, you can select whether you want to run or debug this particular test or suite. In the editor, next to each test and test suite you can see an icon that shows the test status for the tests that you’ve run recently. If you have lots of tests and you only want to run some of them, you have several options available. If you want to find a particular test in the test results, just start typing its name and then use the up and down arrows to jump between the matched test names. Use the icons at the top of the Run tool window to show or hide all the passed tests from the results. For failed tests, it will open the line that was at the top of the stack trace. On the right, you will see a stack trace for the tests that failed.ĭouble-click the test name in the list to open it in the editor. You can also see the test results in the editor, right next to the test.Īll the tests will be listed in a tree view on the left side of the tool window. In the Run tool window that opens, you can track the test progress and see all the test results. Click the green icon next to it to run it. You will immediately see the new configuration in the top right-hand corner of the IDE. Usually, you don’t have to change anything in the configuration, but if there’s a Jest configuration file in the project or you need to pass additional flags to Jest, you can always tweak the settings in the created configuration.įor now, we’ll just select the All tests radio button and click OK to save the run/debug configuration.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |