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

Commit 73b3777

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 db53352 commit 73b3777

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
}
937937
})();
938938

939+
// function returned by inject(), when called outside of test spec
940+
// context, may have stored state so do not reuse the result from this
941+
// call in multiple test specs
939942
function testInjectCaller() {
940943
var shouldThrow;
941944
var injectingCall = (function internalInjectCaller() {

0 commit comments

Comments
 (0)