Skip to content

Unit Testing & Code Coverage With Geddy

Robert Kowalski edited this page Oct 10, 2013 · 2 revisions

Using tests with geddy

This handles ReferenceError: geddy is not defined:

You probably used jake test instead of geddy jake test.

Using geddy jake test will populate the geddy variable in your tests.

Code Coverage With Geddy & Using Mocha

To set up:

Modify your jakefile for running Mocha like this one: https://gist.github.com/BryanDonovan/5022389

Read Mocha's documentation for setting up tests and you're good to go

Run: geddy jake test-run (or whatever you named your jake task)

Link to original issue page: https://github.com/mde/geddy/issues/337 Many thanks to @MiguelMadero for his quick help.

EDIT: Here is a link to my Jakefile and one Mocha test file. This code creates a new directory next to the app directory and code covers the code there using node-jscoverage, then runs tests. (read the README first if you need help) https://github.com/elayman/GeddyUnitTest