Need help with coffeescript-koans?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

445 Stars 162 Forks Other 76 Commits 1 Opened issues


Koans: learn CoffeeScript by doing it

Services available


Need anything else?

Contributors list

# 548,156
45 commits
# 28,811
6 commits
# 375,870
1 commit
# 314,847
1 commit
# 13,680
React N...
1 commit
# 734,412
1 commit
# 774,058
1 commit

CoffeeScript Koans

The goal of the CoffeeScript koans is to teach you CoffeeScript programming through actually doing it, in a test-first fashion.

When you first run the Koans, you'll be presented with a run-time error and a stack trace indicating where the error occurred. Your goal is to make the error go away. As you fix each error, you should learn something about the CoffeeScript language and functional programming in general.

Your journey towards CoffeeScript enlightenment starts in the Koans folder with the file.

These Koans will be very simple, so don't over-think them! As you progress through more Koans, more and more CoffeeScript syntax will be introduced which will allow you to solve more complicated problems and use more advanced techniques.

Getting Started

This project requires Node.js - if you haven't already installed it I would recommend installing the Node Version Manager - NVM - and using that to install Node.

Install dependencies by using npm from the command line:

npm install

Running the Koans

Start with copying the file koans/ to the completed-koans/ folder.

Run the tests with Mocha on the command line:

npm test

You should see the following output:

About Should
    1) should expect true
    - should have filled in values
    - should understand type coercion is fixed
    - should expect equality
    - should assert equality a better way

0 passing (7ms)

You'll see that one of the tests is failing, and that the other 4 have been temporarily disabled (marked as 'pending').

Edit the file (your copy in the completed-koans/ folder) with the editor or IDE of your choice and follow the directions to fix the problem in the first test.

When you think you've fixed the problem, run the tests again.

npm test

When that test passes, enable the next pending test. Rinse and repeat until all tests turn green, simples :-)

When you're done with, copy another file from the koans/ folder to the completed-koans/ folder and start work on that.

I would suggest trying them in the following order, but it is not prescriptive:


If you want to just test a single test file, you can do it like this: (remember to add in the name of your file)

mocha --compilers coffee:coffee-script/register -R spec completed-koans/

If you want mocha to watch your files for changes and rerun the tests automagically when you save changes to a test file, simply use:

npm run watch

Have fun, and I hope you enjoy playing with CoffeeScript!

Endorse this project

To say 'thanks' please endorse this project on Coderwall by clicking the button below:


Or, if you happen to be in London, please drop by for a chat and buy me a beer!

Inspirations & thanks

  • David Laing & Greg Malcolm - for their JavaScript/Jasmine port of the Ruby koans
  • Edgecase - for the great Ruby Koans
  • Jeremy Ashkenas and the CoffeeScript crew on GitHub - for making CoffeeScript in the first place
  • Douglas Crockford - for JavaScript; the good bits
  • Daniel P. Friedman & Matthias Felleisen - for 'The Little LISPer' book, where it all started

License (legal deed)

The text below is a human-readable summary of (and not a substitute for) the license, contained in the LICENSE file.


Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)

You are free to:

  • Share — copy and redistribute the material in any medium or format
  • Adapt — remix, transform, and build upon the material

The licensor cannot revoke these freedoms as long as you follow the license terms.

Under the following terms:

  • Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • NonCommercial — You may not use the material for commercial purposes.
  • ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
  • No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.


You do not have to comply with the license for elements of the material in the public domain or where your use is permitted by an applicable exception or limitation. No warranties are given. The license may not give you all of the permissions necessary for your intended use. For example, other rights such as publicity, privacy, or moral rights may limit how you use the material.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.