Reports expectation failures in afterAlls

This makes the specs green and appears to work for most cases. I have a
number of concerns about the implementation and would appreciate
ideas/feedback.

- Suite#addExpecationResult infers if it is coming from an afterAll fn
  based on if the first child of the suite is finished. This assumes
  that the first child of the suite is a spec (this appears to be true
  as long as there is at least one spec in the suite)
  - Suites behave like unfinished specs. Because suites will propagate
    expectation failures to their children suites, the afterAll
    expectation reporting appears to work for suites without specs
    unless you have:
    1) An otherwise empty suite with an afterAll
    2) An afterAll'd suite whose first suite is empty (or whose first
    suite's first suite is empty (and so on))
- Changed afterAllError to afterAllEvent, so it can accommodate both
  errors and expectation failures. The reporter now receives a string
  instead of the actual error object. The loss of the object doesn't
  affect our reporters, but may be a nice-to-have for other reporters/
  the future.
- The gap between the expectations caught in Suite and QueueRunner (who
  triggers reporting via an injected callback) is an array injected into
  QR by the Suite. The array is then flushed at some point (currently
  after the attempt… functions). This works, but is a bit goofy.

[#73741654]
This commit is contained in:
Greg Cobb and Tim Jarratt
2014-08-26 18:04:12 -07:00
parent 1bad048c15
commit 97867b2bf5
9 changed files with 93 additions and 33 deletions

View File

@@ -65,7 +65,7 @@ jasmineRequire.HtmlReporter = function(j$) {
currentParent.addChild(result, 'spec');
};
this.afterAllError = function(error) {
this.afterAllEvent = function(error) {
exceptionList.push(error);
};
@@ -142,7 +142,7 @@ jasmineRequire.HtmlReporter = function(j$) {
alert.appendChild(createDom('span', {className: statusBarClassName}, statusBarMessage));
for(i = 0; i < exceptionList.length; i++) {
var errorBarMessage = 'An error was thrown in an afterAll: ' + (exceptionList[i].message || exceptionList[i].description);
var errorBarMessage = 'AfterAll ' + (exceptionList[i]);
var errorBarClassName = 'bar errored';
alert.appendChild(createDom('span', {className: errorBarClassName}, errorBarMessage));
}