Skip to content

Running Unit Tests written in TypeScript

Matthew Manela edited this page Apr 5, 2015 · 5 revisions

Chutzpah supports running unit tests you write in the TypeScript language. You need to tell Chutzpah how to compile your files into JavaScript using the compile setting in the chutzpah.json file. There is an example of this for [TypeScript in the samples folder|https://github.com/mmanela/chutzpah/tree/master/Samples/Compilation/TypeScript].

For example given a TypeScript test file that references another TypeScript file:

// <reference path="../code/code.ts" />

test("A basic test", function(){
  ok(true, "this test is fine");
  value = "hello";
  equal("hello", value, "We expect value to be hello");
});

Chutzpah will parse that file as well as the referenced code.ts file and search for matching .js files that your compile step generates.