Skip to content

Commit 59a675b

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 58ec247 commit 59a675b

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
@@ -936,6 +936,9 @@ describe('ngMock', function() {
936936
// call in multiple test specs
937937
function testInjectCaller() {
938938
var shouldThrow;
939+
// using an extra internalInjectCaller() wrapper here avoids stack trace
940+
// constructed by some browsers (e.g. FireFox) from containing the name
941+
// of the external caller function
939942
var injectingCall = (function internalInjectCaller() {
940943
return inject(function() {
941944
if (shouldThrow)

0 commit comments

Comments
 (0)