Skip to content

Commit 58ec247

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 42cecb9 commit 58ec247

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
@@ -931,6 +931,9 @@ describe('ngMock', function() {
931931
}
932932
})();
933933

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

0 commit comments

Comments
 (0)