7b27009e20
When an @NgModule is imported more than once in the testing module (for example it appears in the imports of more than one module, or if it's literally listed multiple times), then TestBed had a bug where the providers for the module would be overridden many times. This alone was problematic but would not break tests. However, the original value of the providers field of the ngInjectorDef was saved each time, and restored in the same order. Thus, if the provider array was [X], and overrides were applied twice, then the override array would become [X, X'] and then [X, X', X, X']. However, on the second override the state [X, X'] would be stored as original. The array would then be restored to [X] and then [X, X']. Each test, therefore, would continue to double the size of the providers array for the module, eventually exhausting the browser's memory. This commit adds a Set to track when overrides have been applied to a module and refrain from applying them more than once. PR Close #29571