# debug js in webstorm
To debug JavaScript code in Webstorm via karma with Jasmine.
# prepare Karma
preparing-to-use-karma-test-runner
The Karma website
# config Karma
A simple karma.conf.js
file generated with the karma command line tool is ok.
Like this and this
# prepare Webstorm and a browser
A browser is needed to execute js. Using Chrome we need a JetBrains plugin
Now create a Karma configuration in webstorm with the "Run/Debug Configurations" window.
It is needed to tell Webstorm the karma.conf.js
file to pick.
# running a test
Select karma in the run/debug config combo box.
Keep the unit test source code file selected in WS.
Add some breakpoints.
Clic on the debug button (or MAJ + F9
)
Enjoy