Skip to content

Commit 6a500fc

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 3da24a0 commit 6a500fc

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

test/ngMock/angular-mocksSpec.js

+3
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,9 @@ describe('ngMock', function() {
934934
// call in multiple test specs
935935
function testInjectCaller() {
936936
var shouldThrow;
937+
// using an extra internalInjectCaller() wrapper here avoids stack trace
938+
// constructed by some browsers (e.g. FireFox) from containing the name
939+
// of the external caller function
937940
var injectingCall = (function internalInjectCaller() {
938941
return inject(function() {
939942
if (shouldThrow)

0 commit comments

Comments
 (0)