beatfactor/nightwatch — pull request #52 by scalvert (2014-02-20 23:32:37+00:00)
Title: Adding global setup/teardown

I added a global setup/teardown that will, if configured, run once per entire test run.

I added a new key to the settings.json file, global_setup_teardown. This will point to a file somewhere.

```json
...
"global_setup_teardown" : "./global_setup_teardown.js",
...
```

The global_setup_teardown.js would look like this:

```javascript
module.exports = {
setUp: function(client) {
// do some global config stuff and such
},
tearDown: function(client) {
// do some global teardown stuff
}
};
```

You'll notice in the code that I extracted the Nightwatch.client(opts) call to the run method, so that there is only one Nightwatch instance for all tests during the run, rather than having one Nightwatch per module run.