Add a unit test for the global error handling including stacktrace
This commit is contained in:
@@ -12,6 +12,20 @@ describe('GlobalErrors', function() {
|
||||
expect(handler).toHaveBeenCalledWith('foo');
|
||||
});
|
||||
|
||||
it('prefers passing the error including stack to the handler', function() {
|
||||
var fakeGlobal = { onerror: null },
|
||||
handler = jasmine.createSpy('errorHandler'),
|
||||
errors = new jasmineUnderTest.GlobalErrors(fakeGlobal),
|
||||
fooError = new Error('foo');
|
||||
|
||||
errors.install();
|
||||
errors.pushListener(handler);
|
||||
|
||||
fakeGlobal.onerror(fooError.message, 'foo.js', 1, 1, fooError);
|
||||
|
||||
expect(handler).toHaveBeenCalledWith(fooError);
|
||||
});
|
||||
|
||||
it('only calls the most recent handler', function() {
|
||||
var fakeGlobal = { onerror: null },
|
||||
handler1 = jasmine.createSpy('errorHandler1'),
|
||||
|
||||
Reference in New Issue
Block a user