In my prior post I talked about how I setup my environment for testing my Typescript source via Jasmine and Chutzpah. That was just the beginning. Now that I had the ability to create unit tests I needed the ability to run them on our CI server, which happens to be Teamcity). I did a bunch of looking around and could not find anything that seemed to work for me, but I did notice that Chutzpah had the ability to run via the command line… GOLD.
Armed w/ the knowledge that I can run my tests from the command line I gave it a whirl. After looking at the docs it appeared I could run get the results I wanted w/ the following.
chutzpah.console.exe /path “c:\path_to_my_typescript_folder_here /teamcity
However, when I ran the above command I got the following output
If you look at the above you will see 33 total test, 22 failures. This is odd because I only have 11 tests. Turns out the command line tool is running my .js files (ones generated via Typescript) and my .ts files. I only wanted to run my .ts files. I figured there had to be a command line switch, but there was not. This sucked because inside of Visual Studio i can set it to ONLY run typescript files as seen below.
I figured I would take a peek at the source to see if I could add support for TestingMode via the command line, turns out I could (side note, I created a fork here and have submitted a pull request for my changes so i hope they are consumed soon)
Now I can run the command w/ the new “/TestMode Typescript” option as below
chutzpah.console.exe /path “c:\path_to_my_typescript_folder_here /testMode TypeScript /teamcity
When I run the above command I get below
With my commits you will see the /testmode option via the help as below
Once I had a working version of Chutzpah which can output my test results all I needed to do was add it to my build script (we use pSake) and bam, I now have Typescript/Javascript tests showing up in my Teamcity builds as seen below
or as shown from from our Teamcity logs
Hope this helps
Till Next Time,
P.S. If you need a copy of my .exe before my changes are added to the master branch let me know.
Posted
12-25-2012 6:54 PM
by
Derik Whittaker