Skip to content

Commit 1d2f5e4

Browse files
committed
test(ngMocks): prevent Safari 10+ optimization that breaks test
1 parent 6b3da2d commit 1d2f5e4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

test/ngMock/angular-mocksSpec.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -936,9 +936,10 @@ describe('ngMock', function() {
936936
})();
937937

938938
function testCaller() {
939-
return inject(function() {
940-
throw new Error();
941-
});
939+
// Assigning to a local variable first, prevents Safari 10+ from inlining
940+
// the function call and having it appear as anonymous in the stack trace.
941+
var fn = inject(function() { throw new Error(); });
942+
return fn;
942943
}
943944
var throwErrorFromInjectCallback = testCaller();
944945

0 commit comments

Comments
 (0)