In this lesson John shows some tricks for speeding up your test suite. He digs into some handy features of WebStorm, including the ddescriber plugin, as well as some alternative methods for Jasmine for selectively running your tests.
John Lindquist: If you've been watching my videos up until now, you've probably noticed that anytime I make a change here, WebStorm waits one second and then runs the tests, so I just make a simple change and it automatically runs them for me. This is done by toggling this button over here, which will auto test, and then setting the auto test delay to one second.
Now, right now, we only have a few tests in there, so it only takes 45 milliseconds, which doesn't really impact your testing flow, but as soon as you get hundreds and thousands of tests, potentially, obviously this isn't an ideal solution, so what you can do to keep this sort of workflow is put an "i" in front of this to make it an "iit," and this will save a ton of time on your test, because it's only going to test this one.
It's going to ignore the rest. You see this yellow, that it's ignoring everything except for this one test, and letting you know that it passed, so you can work on one test at a time. That also works with the describes. If you want to work on one suite at a time, it will only run that one suite, so that's everything in the suite.
You can also exclude by using the X, so exit, which kind of makes sense, so that will exclude that test. You'll see it doesn't show up, and then there's also a trick in WebStorm. There's a plugin called "ddescriber," so if you go into plugins and browser repositories you find this guy. It allows you to select the test in a dialog. I want to include this one, exclude that one. I hit OK, and it'll change them for me.
It'll keep track of what's going on, because if you have these hidden throughout your project, they may be hard to find without doing just a string search for them, so it's much easier to pop open this dialog, see what's green, see what's red, and hitting Alt-I to include them or Alt-X to exclude them. Once that's done, it'll change those for you. That makes it much easier and it keeps your test flow running nice and fast.
ddescribe and iit have been renamed to fdescribe and fit, accordingly.
ddescribe and iit have been renamed to fdescribe and fit, accordingly. Thanks a lot!