I'm working with Ionic2 and want to run unit tests so I set up Karma and Jasmine. Unfortunately WebStorm puts a line through all my jasmine keywords like describe, it, expect etc.
How can I disable this behavior? Why does WebStorm do this?
Related
From what I understand about testing in Javascript, test runners like Karma are used to run the tests written in test frameworks like Mocha.
Now, my question is, how do tests execute when I input a command like mocha in my npm project without having Karma?
Is my understanding of these testing terms faulty or is there something that I am missing here?
Note: I have read that Karma is used to run tests on various browsers as well as various devices. But then how is Mocha different from it? Is it just that Mocha's output is on the terminal while Karma outputs on the browser??
I've just upgraded to WebStorm 2017.1 and suddenly I have these very nice "run this test" buttons in my test files:
However, any time I click one of these buttons, WebStorm is autogenerating a Mocha test target:
The problem is, I'm using Karma for unit tests on this project. I've already followed the instructions from the WebStorm documentation on setting up Karma. I've set up Karma defaults and manually created a Karma target (and removed all Mocha targets, as far as I know), but the IDE still tries to autogenerate a Mocha target any time I ask it to run tests.
How do I tell WebStorm that it should use Karma to run tests, rather than Mocha?
The official answer from JetBrains as of 2017-03-23 is that running individual tests with Karma is not currently supported. This feature request (about 2.5 years old now) is being tracked as WEB-13173.
I'm trying to have Delve drop into a debugger when a test from the testing package fails. How can I do this?
For reference, I'm looking for functionality similar to nose, pytest, or other python testing packages. Using nose, I can do
nosetests test_things.py --pdb
which would let me trop into a debugger when any unit tests fail.
I have looked for three days straight now, and I have great problems finding a good guide to this setup:
Goal: Unit testing of functions created by developers in our team.
Solution uses Visual Studio 2015 (+ Resharper).
Solution contains Web project, which is an Angular2 based website, with code written in typescript. This typescript is what is supposed to be unit tested.
What I managed to do: Set up Jasmine as separate project in the solution. It works, I can create tests that test themselves (expect(7+1).toBe(8) kind of thing).
What I failed to do: Set up Jasmine to be able to compile .ts stuff on the fly (I guess?), to be able to reference .ts files and test them.
TL;DR: I need help setting up a Visual Studio project, in an already existing Angular2 solution, that will allow me to use Jasmine to unit test typescript files. (Perhaps someone has run across a guide that would help).
I managed to rectify my issue by redefining what I needed.
I installed karma & jasmine in the root app project (where the .ts-es are). Then used webpack to package those .ts-es along with tests (also written in TypeScript).
I used this guide:
http://ericnish.io/blog/set-up-jasmine-and-karma-for-angularjs/
Then this one:
https://templecoding.com/blog/2016/02/02/how-to-setup-testing-using-typescript-mocha-chai-sinon-karma-and-webpack/
The biggest issue was the webpack, but I have also got it to work.
I like the Unit test runner in ReSharper 4.5, and would like to use it with my MSTest tests, but one thing annoys me:
In some of our solutions, we have set up some Deployment Items in the .testrunconfig file. The ReSharper Unit Test runner does not seem to respect this, so I get errors when trying to run the unit tests from ReSharper.
Is there any workraound for this ?
Update:
citizenmatt's answer was correct, the option to use a .testrunconfig with ReSharper exists in the Options dialog of ReSharper. You have to select the unit test provider on the list, then the controls to do that appears. (That was not obvious or discoverable, at least not for me ;-)
Have you had a look in the Unit Testing options page? There's a setting there to allow you to use a specified test run configuration, or a test run configuration specified in a metadata file. I'm not sure what it means - I've never used it - but it sounds like it might help.
Why not use Post-Build event of your test project? Put all your deployable items in a .BAT (.cmd) file and call it in Post-Build event to get everything deployed.