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

Commit f7a1691

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 73b3777 commit f7a1691

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
@@ -941,6 +941,9 @@ describe('ngMock', function() {
941941
// call in multiple test specs
942942
function testInjectCaller() {
943943
var shouldThrow;
944+
// using an extra internalInjectCaller() wrapper here avoids stack trace
945+
// constructed by some browsers (e.g. FireFox) from containing the name
946+
// of the external caller function
944947
var injectingCall = (function internalInjectCaller() {
945948
return inject(function() {
946949
if (shouldThrow)

0 commit comments

Comments
 (0)