airportyh/testem — pull request #267 by inossidabile (2013-08-15 22:22:24+00:00)
Title: Better hooks

Further improvements of programmatic access (see #266). So far I have...

1. finished what you seem to have started with `HookRunner` to get rid of mess and code duplication. All the hooks in all modes now run equally, with the single piece of code.
2. added ability to pass arguments to `runHook`. They were implemented as optional parameter so interface didn't change, just extended. They get injected into hook command just like `url`, `host` and `port`.
3. allowed hook to be a javascript function. You can't pass that from YAML or JSON for sure but you still can pass that in from direct `Api` call (see #266). Javascript functions accept three arguments: `(config, data, callback)` and are expected to pass `err` into callback if something goes wrong.
4. implemented `on_change` hook handling `{file: ...}` as argument. Finally – no more recompilation of hundreeds of coffee specs on every change :feelsgood:

And where would we be with all these if I wouldn't extend list of possible configs with JS? ;) Check out `examples/dynamic_config` for a use case.

I really hope it will be merged :smirk_cat: