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

Commit 9b635bb

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 0c1b078 commit 9b635bb

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
@@ -949,6 +949,9 @@ describe('ngMock', function() {
949949
}
950950
})();
951951

952+
// function returned by inject(), when called outside of test spec
953+
// context, may have stored state so do not reuse the result from this
954+
// call in multiple test specs
952955
function testInjectCaller() {
953956
var shouldThrow;
954957
var injectingCall = (function internalInjectCaller() {

0 commit comments

Comments
 (0)