Replace old "catch exceptions" logic with proper fail fast with error reporting

- Option is called stopOnSpecFailure

[#85966014]
- See #414
- See jasmine/jasmine-npm#16
This commit is contained in:
Gregg Van Hove
2018-01-30 11:36:56 -08:00
parent e908b67b19
commit e15f273f06
14 changed files with 191 additions and 133 deletions
+18 -1
View File
@@ -157,7 +157,7 @@ describe("Spec", function() {
spec.execute('cally-back', true);
expect(fakeQueueRunner).toHaveBeenCalledWith(jasmine.objectContaining({
onComplete: 'cally-back',
onComplete: jasmine.any(Function),
queueableFns: [{fn: jasmine.any(Function)}],
cleanupFns: [{fn: jasmine.any(Function)}]
}));
@@ -224,6 +224,23 @@ describe("Spec", function() {
expect(done).toHaveBeenCalled();
});
it("should call the done callback with an error if the spec is failed", function() {
var done = jasmine.createSpy('done callback'),
spec = new jasmineUnderTest.Spec({
queueableFn: { fn: function() {} },
catchExceptions: function() { return false; },
resultCallback: function() {},
queueRunnerFactory: function(attrs) {
spec.result.status = 'failed';
attrs.onComplete();
}
});
spec.execute(done);
expect(done).toHaveBeenCalledWith(jasmine.any(jasmineUnderTest.StopExecutionError));
});
it("#status returns passing by default", function() {
var spec = new jasmineUnderTest.Spec({queueableFn: { fn: jasmine.createSpy("spec body")} });
expect(spec.status()).toBe('passed');