I am writing some unit tests for my TypeScript collection classes (actually migrating some older tests), and I decided in going with Mocha.
How easy it is? Well, as simple as 1, 2, 3 ... 4 :) :
1. Install the typing files
2. Write your test(s)
For this example, I'm presenting you a super simple test, but obviously nothing stops you from adding new ones (check my github core-lang project for details):
3. Build your test(s)
I use Grunt, so I have (I deleted all the non test stuff), but is basically easy to see the target that is named "test" across all the plugins in the original full Grunt file:
Yes, that is all the configuration that you need to do full builds, including running the test suite. Sweet!
I use a layout similar with maven (src/main holds the main sources, src/test holds the test sources, stuff that can get discarded gets built into the target folder).
4. Run them
And because we're writing TypeScript, we get all the cool-cool stuff such as autocomplete, or jump to definition, etc. using Visual Studio Code.
Man, I really-really like TypeScript.