Is it possible to run single Jasmine test it
or suite describe
in IntelliJ from popup menu as it possible with JUnit or TestNG fremeworks?
Now I can only execute tests by running karma.conf.js
that will grab all specs and run them which is not exactly what I want.
This is known issue please upvote it.
Rerun a single testRight-click a test on the Test Runner tab of the Run tool window and select Run 'test name'.
You can use fit() or fdescribe() instead of it() and describe() to achieve what is known as focussed test cases. describe("test spec", function() { it("test case 1", function() { }); fit("test case 2", function() { }); }); In the above example, only test case 2 would get executed.
Show activity on this post. Open the class where the tests are located and check the part where inteliJ shows the the number of lines, at the beginning of each test method there is a green icon (looks like a play button) just hit that icon and the specific test method will be executed.
You don't need Intellij's help if you are trying to run a single unit test or a single test suite while using Jasmine. You can do that with their feature of fit()
and fdescribe()
. Here, prepending it(...)
and describe(...)
with f
says those are focused tests/test suites.
Quoting the documentation (Jasmine 2.1 and above),
Focusing specs will make it so that they are the only specs that run.
Any spec declared with
fit
is focused. You can focus on a describe withfdescribe
You could follow this issue in YouTrack - https://youtrack.jetbrains.com/issue/WEB-13173.
We have supported --grep
[1] option for jasmine in karma already.
But there are some open discussions about problems in large projects[2]
[1] - https://github.com/karma-runner/karma-jasmine/pull/56
[2] - https://github.com/karma-runner/karma/issues/1235
Thanks!
With WebStorm 2017.1 it's possible to use RunConfiguration producer to run a single Karma test: https://github.com/develar/ij-rc-producer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With