Executing TypeScript unit tests with Chutzpah

If you’re already using Chutzpah to execute your JavaScript tests, but you’ve actually got TypeScript (and you were just executing the underlying JavaScript files), it is actually pretty simple to change things up and have Chutzpah report about the TypeScript files instead.

Change a lot of extensions in your chutzpah.json to specify the TypeScript files instead of JavaScript files, and add a Compile node to your json file:

The key is to rely on the External value for Mode, which will assume that a prior build step compiled the TypeScript into JavaScript. Full documentation for this setting can be found on the Chutzpah wiki.

The UseSourceMaps option is also valuable as it allows the JavaScript files to be mapped back properly to the TypeScript. This is especially important if you’ve enabled code coverage!