angular/protractor — pull request #1485 by hankduan (2014-10-31 23:24:45+00:00)
Title: chore(launcher): reorganize launcher

---experimental---
After months of commits/changes to runner and launcher code, I think it needs a little clean up. This change has no feature changes or significant output changes.

motivation:
1) BEFORE: running single test vs forked (sharded/multibrowser) use completely different code paths in terms of error handling, what runner returns, adding listeners, etc, leading to issues like https://github.com/angular/protractor/pull/1448. Furthermore, at the current state, it means that whenever we need to process the output (i.e. store test output into json file), we need to write different logic to deal with the 2 paths.
NOW: launcher always calls runnerfork with a parameter to fork or not. `runnerfork.run()` always returns a promise with results of the run, and reject on errors

2) BEFORE: Some files contains multiple not-very-related classes that are growing pretty big (i.e. launcher contains reporter, launcher, runnerfork). Moreover, these classes are mutating shared variables and these classes would undoubtedly become more intertwined in the future, leading to future problems
NOW: broke launcher into launcher, logger, runnerfork

3) BEFORE: It is difficult to add additional processing to test outputs because 1) jasmine/mocha/cucumber report test results in different ways and 2) runner doesn't expose key test outputs like which specs failed, timing, error message, etc.
NOW: jasmine/mocha/cucumber consolidate run result into a uniformed form, which runnerfork returns after it finishes running the test.