Trying to setup unit testing for Typescript project using Karma

karma-runner, typescript

Solution

I just set up a Karma/Typescript test but it's not using Node.js. I'm using Intellij Idea 13 and the Karma plugin, and I followed this process here:

http://www.youtube.com/watch?v=4CgKU7jTub4

The basic steps are:

- Set up a watcher to compile your Typescript files as you save them.

- Set up your Karma setup using Karma init karma.conf.js (I'm using Chrome/Jasmine)

- Add your js files to the list of files to make sure they're included in the test.

- Download the Typescript definition for Jasmine/Jasmine-Jquery as a global library.

It wasn't too painful, and Webstorm adds a nice GUI to the whole operation.

Problem

I am trying to use Karma to test a NodeJS project written in Typescript. I want to use tsUnit as the Unit test framework http://tsunit.codeplex.com/ and the karma-typescript-preprocessor to get karma to compile typescript first. https://npmjs.org/package/karma-typescript-preprocessor This is turning out to be a very bumpy ride and I would love to understand the process from anyone who has experience setting up Karma to test Typescript over NodeJS. Even if you have used a different test framework or preprocessor.

Original source