Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ivy): fix proliferation of provider overrides for modules #29571

Closed

Commits on Mar 28, 2019

  1. fix(ivy): fix proliferation of provider overrides for modules

    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.
    alxhub committed Mar 28, 2019
    Configuration menu
    Copy the full SHA
    d76d678 View commit details
    Browse the repository at this point in the history