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

Commit bd3208c

Browse files
refactor(ngMock window.inject test): comment on important function wrapper usage
Explicitly commented on why we use an extra function wrapper around the test inject Error throwing code, and how not using it would make our tests give us false positives on certain browsers, e.g. Firefox.
1 parent 1dd4d40 commit bd3208c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

test/ngMock/angular-mocksSpec.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,9 @@ describe('ngMock', function() {
939939
// call in multiple test specs
940940
function testInjectCaller() {
941941
var shouldThrow;
942+
// using an extra internalInjectCaller() wrapper here avoids stack trace
943+
// constructed by some browsers (e.g. FireFox) from containing the name
944+
// of the external caller function
942945
var injectingCall = (function internalInjectCaller() {
943946
return inject(function() {
944947
if (shouldThrow)

0 commit comments

Comments
 (0)