PyCharm 2020.3 Help

Testing JavaScript

With PyCharm, you can run and debug JavaScript unit tests using Mocha, Karma, Jest, Protractor, and Cucumber.js.

You can see the test results in a treeview and easily navigate to the test source from there. Test status is shown next to the test in the editor with an option to quickly run or debug it:

ws_run_test_from_editor.png

For Jest, Karma, and Mocha you can also see a code coverage report right in PyCharm.

Structure view for tests

Running and debugging tests

Before you start with testing JavaScript, make sure the chosen test runner is installed and set up in your project as described on the corresponding page.

Quickly run or debug a single test with Mocha, Karma, or Jest

  • Click Run or Rerun in the left gutter and choose Run <test_name> or Debug <test_name> from the list.

Run or debug tests using a run/debug configuration

  • In the Run/Debug Configuration dialog (Run | Edit Configurations), click Add New Configuration, select the appropriate configuration type, and fill in the required fields.

  • Save the configuration and click Run, Run with Coverage, or Debug on the toolbar.

Last modified: 19 August 2020