Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit d98ce05

Browse files
petebacondarwinNarretz
authored andcommitted
test($log): fix up to work with Safari 9
On Safari 9.0.2, you are not allowed to write to `sourceUrl` or `line` on a native Error object. This commit uses a custom error instead.
1 parent 9fb7716 commit d98ce05

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

test/ng/logSpec.js

+19-9
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,26 @@ describe('$log', function() {
138138
describe('$log.error', function() {
139139
var e, $log, errorArgs;
140140

141+
function TestError() {
142+
Error.prototype.constructor.apply(this, arguments);
143+
this.message = undefined;
144+
this.sourceURL = undefined;
145+
this.line = undefined;
146+
this.stack = undefined;
147+
}
148+
TestError.prototype = Object.create(Error.prototype);
149+
TestError.prototype.constructor = TestError;
150+
141151
beforeEach(function() {
142-
e = new Error('');
143-
e.message = undefined;
144-
e.sourceURL = undefined;
145-
e.line = undefined;
146-
e.stack = undefined;
147-
148-
$log = new $LogProvider().$get[1]({console:{error:function() {
149-
errorArgs = [].slice.call(arguments, 0);
150-
}}});
152+
e = new TestError('');
153+
var mockWindow = {
154+
console: {
155+
error: function() {
156+
errorArgs = [].slice.call(arguments, 0);
157+
}
158+
}
159+
};
160+
$log = new $LogProvider().$get[1](mockWindow);
151161
});
152162

153163

0 commit comments

Comments
 (0)