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

Commit 1dd4d40

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 bb752d1 commit 1dd4d40

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
@@ -934,6 +934,9 @@ describe('ngMock', function() {
934934
return !!error.stack;
935935
})();
936936

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

0 commit comments

Comments
 (0)