-
Robert Knight authored
The Angular.js bundle was evaluated a second time because a module that required angular was proxyquire-d in session-test.js. When `proxyquire(...)` loads a module, it does so with a fresh, empty module cache [1] which is removed once the `proxyquire(...)` call returns. As a result, every module that is transitively required by the proxyquire'd module will be re-evaluated during the `proxyquire(...)` call. Aside from the performance cost for large modules, this is also bad for any module which has side-effects as part of its evaluation. Angular happens to detect this and abort when evaluated a second time. The fix here is to use Angular's DI system to mock the only stubbed dependencies instead of proxyquire. [1] The _module cache_ is a (module ID/name => exports object) map.
a18bdaf6