Reputation: 10067
I install Webstorm 11 and want to run my tests (for node.js app) implemented with Jasmine. However it's not easy to do that. I could just type in command line 'jasmine' command and test will be runned, but in this case I'm not able to debug code. So is there a way to configure Webstorm to deal with jasmine specs as it should?
Upvotes: 10
Views: 2042
Reputation: 93728
WebStorm doesn't manage test running directly. This job is done by a test runner. WebStorm supports several test runners - Mocha, Karma, JsTestDriver, nodeunit. Most of them can execute Jasmine tests
Upvotes: 0
Reputation: 6959
Jasmine works with the JSTestDriver which you get out-of-the-box with WebStorm 11: https://www.jetbrains.com/webstorm/help/enabling-javascript-unit-testing-support.html
This page also details how to add Jasmine within JSTestDriver: https://www.jetbrains.com/webstorm/help/preparing-to-use-jstestdriver-test-runner.html
At a high level you're going to:
load:
lib/jasmine/jasmine.js
lib/jasmine-jstd-adapter/JasmineAdapter.js
Upvotes: 0
Reputation: 10067
Ok, so while no one answer at the moment I will try to provide my version: This flow will allow to run jasmine testsute from Webstrom and debug testcases
in project folder create folder 'spec/support' In this folder place jasmine.json
tests configuration example:
{
"spec_dir": "tests",
"spec_files": [
"**/*[sS]pec.js"
],
"helpers": [
"helpers/**/*.js"
]
}
Create node.js configuration in Webstorm
In this configuration select source file - jasmine executable file (for localy installed
jasmine it will be 'node_modules\jasmine\bin\jasmine.js'
)
So you are ready. However at the current moment when trying to debug this configuration - it fails with error:
Cannot stop on breakpoint due to internal error org.jetbrains.v8.V8CommandProcessor$1:
If you faced with it - you need to change Webstom configuration and set this settings:
-Dnodejs.debugger.use.jb.support=false
For more details check there:
So this allow you to run jasmine tests and debug them. However there is still some things which this solution not able to do:
Jetbrains, if you reading this - please fix this already. I started play with node in Webstorm 3 years ago and since that moment and dozens of version there is still no nice way to run tests. It's ridiculous.
Upvotes: 11