0

I need a way to test my TypeScript files that integrates with Visual Studio's Test Explorer. For that I found an extension that does it, Chutzpah [codeplex].

The problem is that the current version of the extension does not work with TypeScript Generics.

Unfortunately that doesn't work with Generics. I hope they release an update.

class Foo<T>

When I use generics it crashes at

foo.ts (3,23): Expected '{'

If I remove Generics and change everything to any it works without any errors.

So, since it is open source, I was wondering how can I change it so it will run with a more update version of TypeScript.

How can I do that?

BrunoLM
  • 97,872
  • 84
  • 296
  • 452
  • 1
    Just linking to your question on codeplex so people can up vote it if they are having the same issue: http://chutzpah.codeplex.com/workitem/141 – rob Jul 05 '13 at 13:25

1 Answers1

1

Can't you just run the tests against the compiled JavaScript - then it wouldn't need to know anything about generics as they are erased by the TypeScript compiler.

You can still write all your tests in TypeScript, but at runtime use the plain JavaScript.

Update: new version of Chutzpah just got released with support for TypeScript 0.9!

Fenton
  • 241,084
  • 71
  • 387
  • 401
  • If you test the javascript directly I think you loose some of the features of Chutzpah like running the tests on save. But yeah it should be an alright workaround until Chutzpah comes out with support for 1.9 – rob Jul 05 '13 at 13:20
  • @rob - I also find testing the output JavaScript means you find out when the compiler has a bug, such as 0.9.0, which was accidentally adding extra `;` into `for` statements, which was breaking (fixed in 0.9.1) – Fenton Jul 05 '13 at 13:22
  • 2
    Update: Chutzpah release - supports 0.9. – Fenton Jul 11 '13 at 07:21