Adding unit tests is straightforward in Meteor. Any files in the tests/ folder will be ignored by the Meteor server.
What you’ll need:
Optional: Growl (for notifications from mocha watch)
Getting everything running:
1 2 3
Setting up Mocha to watch our coffee files and send Growl notifications:
Now to create a sample test:
1 2 3 4 5
Mocha should notice the file change and run the tests showing you the passing test.
Some notes: – The growl notification didn’t work for me, but I assume that’s because I’m using an old version. – When using Mocha watch, sometimes a failing test result would be outputted many times – Jasmine should also work fine