refactor(compiler): introduce TestBed.deprecatedOverrideProvider (#19558)

This allows use to fix `TestBed.overrideProvider` to keep imported `NgModule`s eager,
while allowing our users to still keep the old semantics until they have fixed their
tests.

PR Close #19558
This commit is contained in:
Tobias Bosch
2017-10-09 14:09:01 -07:00
committed by Chuck Jazdzewski
parent e292548523
commit 3959b7ef28
2 changed files with 60 additions and 5 deletions

View File

@ -71,6 +71,13 @@ export declare class TestBed implements Injector {
}): void;
configureTestingModule(moduleDef: TestModuleMetadata): void;
createComponent<T>(component: Type<T>): ComponentFixture<T>;
/** @deprecated */ deprecatedOverrideProvider(token: any, provider: {
useFactory: Function;
deps: any[];
}): void;
deprecatedOverrideProvider(token: any, provider: {
useValue: any;
}): void;
execute(tokens: any[], fn: Function, context?: any): any;
get(token: any, notFoundValue?: any): any;
/** @experimental */ initTestEnvironment(ngModule: Type<any> | Type<any>[], platform: PlatformRef, aotSummaries?: () => any[]): void;
@ -94,6 +101,13 @@ export declare class TestBed implements Injector {
}): typeof TestBed;
static configureTestingModule(moduleDef: TestModuleMetadata): typeof TestBed;
static createComponent<T>(component: Type<T>): ComponentFixture<T>;
/** @deprecated */ static deprecatedOverrideProvider(token: any, provider: {
useFactory: Function;
deps: any[];
}): void;
static deprecatedOverrideProvider(token: any, provider: {
useValue: any;
}): void;
static get(token: any, notFoundValue?: any): any;
/** @experimental */ static initTestEnvironment(ngModule: Type<any> | Type<any>[], platform: PlatformRef, aotSummaries?: () => any[]): TestBed;
static overrideComponent(component: Type<any>, override: MetadataOverride<Component>): typeof TestBed;