Derik Whittaker

Syndication

News


Running Typescript tests via Jasmine and Chutzpah on Teamcity

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

image

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.

image

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

image

With my commits you will see the /testmode option via the help as below

image

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

image

or as shown from from our Teamcity logs

image

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
Filed under: , ,

[Advertisement]

Comments

Raif wrote re: Running Typescript tests via Jasmine and Chutzpah on Teamcity
on 12-25-2012 8:18 PM

Hi Derik,

I'm looking at psake and I kinda like it.  What's 'bam' ?  Does that in some way compliment psake?

Raif

Derik Whittaker wrote re: Running Typescript tests via Jasmine and Chutzpah on Teamcity
on 12-25-2012 8:25 PM

@Raif,

Yes, that 'Bam' was meant as a compliment.  We have been very happy w/ pSake.  The 'Bam' was also meant to indicate 'it just worked' which is always what I want :)

Raif wrote re: Running Typescript tests via Jasmine and Chutzpah on Teamcity
on 12-26-2012 10:36 AM

uh, yea, I see. duh.  bam! I liked this article!

Having trouble with the pshell though.  Seems that I need to allow each file individually and once that's done I'm getting a "build success can not be found" error.  

I'll keep plugging away I;m sure it simple.

thx

Derik Whittaker wrote re: Running Typescript tests via Jasmine and Chutzpah on Teamcity
on 12-26-2012 10:58 AM

@Raif,

You dont need each file, least not w/ MY exe (for typescript files that is).  Email me via the contact form and i will send you my exe.

Jay Turpin wrote re: Running Typescript tests via Jasmine and Chutzpah on Teamcity
on 12-26-2012 8:37 PM

Thanks for the post Derik! You haven't happened to figure out how to resolve all of the file dependency issues, have you? I'm struggling with how get chutzpah to recognize the <reference path= used in the typescript tests.

Thanks!

Derik Whittaker wrote re: Running Typescript tests via Jasmine and Chutzpah on Teamcity
on 12-26-2012 8:47 PM

@Jay,

I have no issues w/ dependencies.

My spec files each have this at the top

/// <reference path="../Scripts/d.ts/jasmine/jasmine-1.2.d.ts" />

/// <reference path="../ViewModels/Includes.ts" />

where the includes.ts file simply has all of my dependencies enumerated in it.

When I run Chutzpah I simply point it to the root of my specs folder and it just works.

Jay Turpin wrote re: Running Typescript tests via Jasmine and Chutzpah on Teamcity
on 12-26-2012 9:07 PM

OK - I guess I have been trying to run jasmine against generated js files, rather than the typescript files. I'll play around further.

Thanks!

Derik Whittaker wrote re: Running Typescript tests via Jasmine and Chutzpah on Teamcity
on 12-26-2012 9:11 PM

@Jay,

Yes, you must run them against the ts files.

buy discount viagra wrote re: Running Typescript tests via Jasmine and Chutzpah on Teamcity
on 02-02-2013 1:30 PM

epcZOn Great, thanks for sharing this blog article. Cool.

buy viagra online wrote re: Running Typescript tests via Jasmine and Chutzpah on Teamcity
on 02-02-2013 4:26 PM

HRmBuR I truly appreciate this article.Really looking forward to read more. Great.

Social bookmarks wrote re: Running Typescript tests via Jasmine and Chutzpah on Teamcity
on 03-22-2013 1:02 PM

XFxlt3 Very good blog.Really looking forward to read more. Really Great.

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
Umbraco
NServiceBus
RavenDb
Web Sequence Diagrams
Ducksboard<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)