Testing CofeeScript with Mocha

May 01, 2012

By Jamison Dance

Mocha is a JavaScript testing library that is great. It used to just run CoffeeScript out of the box, but recently they factored support out, probably to support all kinds of languages that compile down to JavaScript in the future. The result is, mocha test/foo.coffee no longer works.

To get mocha to run test written in CoffeeScript, run the following:

mocha test/foo.coffee --compliers coffee:coffee-script

Notes to my future self who keeps forgetting this.

Jamison cares about family and programming and React Rally and Soft Skills Engineering and 🏋️ and 🏂 and computing and business and the Dunning-Kreuger effect. He is a real human bean who you can reach on Twitter.