|Configuring Intellij 11.0 to Run the unit tests of the phoneCat tutorial||Carlos Serrano||3/23/12 4:56 PM|
I´m new to angular and I´m doing the phoneCat tutorial ( http://docs.angularjs.org/#!/tutorial ) in intelliJ 11.0
I´ve had quite some trouble configuring intelliJ to run the unit tests so I thought I would share the problems I´ve encountered and how to solve them in case somebody tryies to do the same.
My procedure to do so have been:
1.- Clone the git seed into a local dir (c:/dev)
git clone git://github.com/angular/angular-phonecat.git
2.- Create a wep project from scratch in idea and point it to the cloned "angular-phonecat" folder, by doing so, I can run in the git console the 'checkout steps' and have the sources automatically updated in Idea.
3.- I installed Node js on my machine (windows 7 proffesional 64bits), and added the Node plugin to IntelliJ
Here a screen capture of the conf I´ve used
Just with that simple configuration I was able to run node from my Intellij.
3.- Then I installed the JsTestDriven plugin from Idea following the instructions in: http://confluence.jetbrains.net/display/WI/Installation+of+JsTestDriver+IntelliJ+plugin
Here is a screen capture of the the jsTestDriver conf I´ve used.
NOTE: in order to get idea to recognize the second conf file I had to change the name of the 'jsTestDriver-scenario.conf' to 'jsTestDriver-scenario.jstd'
Up to this point I was able to launch the test driver server from intellij and capture a browse, but when I tryied to run the unit tests of the tutorial I started getting problems.
If you try to run the tests with these configurations the console shows an error that says that it can´t find any of the resources to load.
Testing started at 00:01 ...
Cannot read [
] derived from test/lib/angular/angular-scenario.js
Cannot read [
] derived from config/jstd-scenario-adapter-config.js
Cannot read [
] derived from test/lib/angular/jstd-scenario-adapter.js
Cannot read [
] derived from test/e2e/scenarios.js
looking at the route of the files you can see that the routes of the files are wrong. The 'test' folder is not inside of the 'config' folder but next to it (they are 'siblings' so to speak) so I changed the routes inside conf files.
The resulinting jsTestDriver.conf file looked like this (i did the same with the 'jsTestDriver-scenario.jstd' file)
But these time I got no error but this message: 'Unable to attach test reporter to test framework or test framework quit unexpectedly' in the event log.
Searching in google I came across these bug
There seems to be a problem with relative paths in config since version 1.3.2 in the jsTestDriver
So thenI reverted my changes on the config files and moved both of them to the root folder (c:/dev/angular-phonecat)
But I got the same message on the event log.
After searching in some forums I got to the conclusion that maybe What I needed to do was to update the jasmine-jstd-adapter to its lates version
so I downloaded the latest version I could find (ibolmo-jasmine-jstd-adapter-1.1.2-0-g19fc291) and override the jasmineAdapter.js script in the C:\dev\angular-phonecat\test\lib\jasmine-jstd-adapter folder with the new one.
and FINALLY i got the tests of the tutorial to work.
|Re: [angular.js] Configuring Intellij 11.0 to Run the unit tests of the phoneCat tutorial||Vojta Jína||3/25/12 1:57 AM|
Hey, thanks for sharing...
Does it work without the plugin (when you execute things from commandline, without IntelliJ) ?
It should. I guess IntelliJ plugin has its own version of JSTD included, which is probably not the latest one.
Btw, we use Misko's fork of Jasmine Adapter: https://github.com/mhevery/jasmine-jstd-adapter
|Re: [angular.js] Configuring Intellij 11.0 to Run the unit tests of the phoneCat tutorial||Carlos Serrano||3/26/12 1:41 AM|
Yes, from the commandline works perfectly.
thanks for the tip about what jasmin adapter to use. :)
|Re: [angular.js] Configuring Intellij 11.0 to Run the unit tests of the phoneCat tutorial||Vojta Jína||3/26/12 1:57 AM|
Then, the problem is that the plugin uses old jstd.
You can try to find the plugin path and jstd jar file and replace it with latest version. That should solve the issue.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/tfWtdZpRMsAJ.
|Re: [angular.js] Configuring Intellij 11.0 to Run the unit tests of the phoneCat tutorial||Carlos Serrano||3/26/12 5:59 AM|
I don´t think the problem is with IntelliJ´s plugin because if I use the Jasmine Adapter from Misko's fork everything works.
And if you look at the jstd plugin note in Intellij it says that is built using JsTestDriver-1.3.4-a witch I thing is the latest version.
The problem is probably the opposite, that the tutorial uses an older version of jstd and the jasmine adapter, and that´s the reason it doesn´t work in IntelliJ.
Anyways everything works fine if you do the tutorial from the command line. And it is not a change if you want to do the tutorial in Intellij.
Thanks for your comments.
|Re: Configuring Intellij 11.0 to Run the unit tests of the phoneCat tutorial||Richard Johnson||3/26/12 9:20 AM|
I helped a friend get the tutorial working with IntelliJ. We found
that the IntelliJ JsTestDriver plugin uses a newer version of
JsTestDriver that requires an updated Jasmine (http://code.google.com/
p/js-test-driver/issues/detail?id=258#c8). The Angular tutorial
includes older Jasmine and JasmineAdapter releases that need to be
updated. I gave these updated files to my friend in a patch file that
she applies against the tutorial directories.
Changing the config files to be relative to the parent directory
("../") is needed because the IntelliJ JsTestDriver plugin doesn't
support the "--basepath" option that the tutorial scripts use to start
the driver. The Angular tutorial scripts specify the basepath to be
the parent so all config files are relative to the parent. When
running the unit tests under the IntelliJ JsTestDriver, the .conf
files need to be edited as you found.
|Re: [angular.js] Re: Configuring Intellij 11.0 to Run the unit tests of the phoneCat tutorial||Vojta Jína||3/26/12 10:53 AM|
I'm sorry, I got confused, you are right.
There is an old version of jstd + jasmine adapter in the tutorial.
> To post to this group, send email to ang...@googlegroups.com.
|Re: Configuring Intellij 11.0 to Run the unit tests of the phoneCat tutorial||Daniel Termin||5/9/12 6:16 AM|
With the help from this thread I think I managed to get the tests running. I just ran the jsTestDriver.conf though. When I tried to run jsTestDriver-scenario.conf I got 'Unable to attach test reporter to test framework or test framework quit unexpectedly' . But maybe I'm not supposed to run that? I'm pretty new with both the Jetbrains tools and testing frameworks, so...
But, as I said, when I run jsTestDriver.conf it works (I tested this by writing a failing test).
|unk...@googlegroups.com||9/5/12 4:51 AM||<This message has been deleted.>|