Skip to content

Commit 3da24a0

Browse files
refactor(ngMock window.inject test): add testInjectCaller() usage comment
The results of this function, when called outside of a specific test spec context, should not be reused in multiple tests as they may have stored state that can cause unwanted test spec interaction. This explains why we may need to wrap some tests into their own separate test suites instead of grouping them all under a single shared one.
1 parent 428f0b9 commit 3da24a0

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
@@ -929,6 +929,9 @@ describe('ngMock', function() {
929929
return !!error.stack;
930930
})();
931931

932+
// function returned by inject(), when called outside of test spec
933+
// context, may have stored state so do not reuse the result from this
934+
// call in multiple test specs
932935
function testInjectCaller() {
933936
var shouldThrow;
934937
var injectingCall = (function internalInjectCaller() {

0 commit comments

Comments
 (0)