Suite level errors all report the same way (on suiteDone)
- For `beforeAll`, `afterAll`, and declaration errors [#150118881] #1409 Signed-off-by: Gregg Van Hove <gvanhove@pivotal.io>
This commit is contained in:
committed by
Gregg Van Hove
parent
414e03bded
commit
12a47f05bf
43
spec/helpers/integrationMatchers.js
Normal file
43
spec/helpers/integrationMatchers.js
Normal file
@@ -0,0 +1,43 @@
|
||||
(function(env) {
|
||||
env.registerIntegrationMatchers = function() {
|
||||
jasmine.addMatchers({
|
||||
toHaveFailedExpectationsForRunnable: function (util, customeEqualityTesters) {
|
||||
return {
|
||||
compare: function (actual, fullName, expectedFailures) {
|
||||
var foundRunnable = false, expectations = true, foundFailures = [];
|
||||
for (var i = 0; i < actual.calls.count(); i++) {
|
||||
var args = actual.calls.argsFor(i)[0];
|
||||
|
||||
if (args.fullName === fullName) {
|
||||
foundRunnable = true;
|
||||
|
||||
for (var j = 0; j < args.failedExpectations.length; j++) {
|
||||
foundFailures.push(args.failedExpectations[j].message);
|
||||
}
|
||||
|
||||
for (var j = 0; j < expectedFailures.length; j++) {
|
||||
var failure = foundFailures[j];
|
||||
var expectedFailure = expectedFailures[j];
|
||||
|
||||
if (Object.prototype.toString.call(expectedFailure) === '[object RegExp]') {
|
||||
expectations = expectations && expectedFailure.test(failure);
|
||||
} else {
|
||||
expectations = expectations && failure === expectedFailure;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
pass: foundRunnable && expectations,
|
||||
message: !foundRunnable ? 'The runnable "' + fullName + '" never finished' :
|
||||
'Expected runnable "' + fullName + '" to have failures ' + jasmine.pp(expectedFailures) + ' but it had ' + jasmine.pp(foundFailures)
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
};
|
||||
})(jasmine.getEnv());
|
||||
|
||||
Reference in New Issue
Block a user