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

Commit 3244cf9

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 9b635bb commit 3244cf9

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
@@ -954,6 +954,9 @@ describe('ngMock', function() {
954954
// call in multiple test specs
955955
function testInjectCaller() {
956956
var shouldThrow;
957+
// using an extra internalInjectCaller() wrapper here avoids stack trace
958+
// constructed by some browsers (e.g. FireFox) from containing the name
959+
// of the external caller function
957960
var injectingCall = (function internalInjectCaller() {
958961
return inject(function() {
959962
if (shouldThrow)

0 commit comments

Comments
 (0)