OscarGodson/EpicEditor — pull request #169 by johnmdonahue (2012-08-11 00:39:38+00:00)
Title: Mocha Port

## PR to get the conversation started.

This is basically just the first pass on the mocha port. It definitely needs some QA and I'd like to know how performance is affected on other machines.

A few things to note:

1. You can run a specific test block by clicking its header. You'll get something like this: `http://localhost:8000/test/tests.html?grep=^\.edit\(\)`, which is handy if you're only trying to test changes to a specific method. This is also why I changed from `index.html` to `tests.html` (as is the convention in mocha's own example) because grep won't work on an empty path: i.e. `http://localhost:8000/test/?grep=^\.edit\(\)`
2. Some test have been removed as redundant - these are mainly tests that checked state before running a test that depended on it but the methods used there should be tested in their specific API block anyway.
3. I reworded all "`should`" descriptions to hopefully better describe the test and fit the standard `expect` conventions.
4. I used EE API calls where possible to hopefully increase performance and readability. This should be ok in most cases since they should be tested on their own regardless. (There are definitely still some slow tests that can be optimized though)
5. All tests have been broken into their own method specific files. This is handy to help get a grasp on coverage and hopefully reduce redundancy and improve findability.
6. I left the foounit test suite intact for now so that performance can be tested. I will do a quick rewrite of `jake test` task soon to just spin up a simple node server.

For anyone interested in playing around, `jake test` will still work to spin up a server until foounit is removed or you can just spin up any local server in the EE repo root and then hit localhost:8000/test/tests.html in a browser, e.g.:

```
$ python -mSimpleHTTPServer
```

I'll work on the larger `package.json`/`Jakefile` refactor on a separate branch when I get some more time. For now I think this works and in fact having Mocha deps included in the repo will allow us to hit the tests live on GHPages as we can now: http://epiceditor.com/spec/runner.html

Let me know any thoughts. :D