adobe/brackets — pull request #1925 by njx (2012-10-24 04:17:35+00:00)
Title: INITIAL REVIEW: Generate JSON from unit tests

@jasonsanjose

This pull request factors out unit test total/pass/fail counts, messages, and perf results into a separate object, TopLevelResults. Once a test run is complete, you can get this results object and call `toJSON()` on it to get summarized output. See the comment on the TopLevelResults constructor for the details of the `suites` property, which is what gets serialized to the JSON output.

Originally I was thinking I would create a third reporter that would run by itself (separately from the Bootstrap and Performance reporters) when in automated test mode. However, I decided that it wasn't really worth refactoring more logic out of the Performance reporter to create a separate reporter that can run headless, because we have to run with the test window, etc. anyway. So rather than creating a separate reporter, I just have the existing reporters push their data into the results object. In retrospect, it might not even have been necessary to factor out the results object itself, but it does seem a little cleaner to have it be separate (and referenced by the two reporters) rather than just having its data mixed into the BootstrapReporter's UI data as it is today (and having the PerformanceReporter call the BootstrapReporter to add perf information).