beatfactor/nightwatch — pull request #296 by barendb (2014-10-20 04:55:52+00:00)
Title: Extend Nightwish to use externally loaded tests.

Extended Nightwish to allow you to use externally loaded tests with the Nightwish CliRunner.

My primary driver for this change, was a requirement to run BDD style tests using Yadda. Their are examples where this was done before: [Yadda + Nightwish.js](https://gist.github.com/kbingman/730b9f2307ef776f1f66)

However because Nightwish's currently loads tests via a filepath, the approach shown above had some limitations.
* Only one test could be run
* Test reporter couldn't deal with multiple modules
* Test reporter didn't reporter didn't record correct steps

### How to use applied changes

You can now load your tests externally and pass it directly to the CliRunner

```javascript
var testModules = [];
testModules.push(require('./tests/sometest'));

var runner = new CliRunner(...);
runner.runPreloadedTests(testModules);
```

### Change notes

All modules require to have a moduleName and moduleKey

```javascript
var testModules = [];
testModules.push(require('./tests/sometest'));

var runner = new CliRunner(...);
runner.runPreloadedTests(testModules);
```
### Notes

* All tests are passing
* Grunt Complexity task fails on run.js
* Changes applied to the run.js meant I had to move quite a number of variables into global scope (within run.js) this is not ideal, if I had more time I would have tried to break run.js into multiple files.