Pick the error instance to pass to error handlers in QueueRunner

The first number is the error message in HTML5 browser, which does not include
the call stack. The error instance allows logging the complete call stack in
reporters.
This commit is contained in:
Ferdinand Prantl
2019-08-11 09:32:31 +02:00
parent 527619b0aa
commit 3a7fc63879
2 changed files with 31 additions and 2 deletions

View File

@@ -514,6 +514,32 @@ describe('QueueRunner', function() {
});
});
it('passes the error instance to exception handlers in HTML browsers', function() {
var error = new Error('fake error'),
onExceptionCallback = jasmine.createSpy('on exception callback'),
queueRunner = new jasmineUnderTest.QueueRunner({
onException: onExceptionCallback
});
queueRunner.execute();
queueRunner.handleFinalError(error.message, 'fake.js', 1, 1, error);
expect(onExceptionCallback).toHaveBeenCalledWith(error);
});
it('passes the first argument to exception handlers for compatibility', function() {
var error = new Error('fake error'),
onExceptionCallback = jasmine.createSpy('on exception callback'),
queueRunner = new jasmineUnderTest.QueueRunner({
onException: onExceptionCallback
});
queueRunner.execute();
queueRunner.handleFinalError(error.message);
expect(onExceptionCallback).toHaveBeenCalledWith(error.message);
});
it('calls exception handlers when an exception is thrown in a fn', function() {
var queueableFn = {
type: 'queueable',