diff --git a/packages/compiler/src/jit/compiler.ts b/packages/compiler/src/jit/compiler.ts index b503dcf773..ff8636c2dc 100644 --- a/packages/compiler/src/jit/compiler.ts +++ b/packages/compiler/src/jit/compiler.ts @@ -91,7 +91,7 @@ export class JitCompiler { } else { const summary = entry as CompileTypeSummary; this._summaryResolver.addSummary( - {symbol: summary.type.reference, metadata: null, type: summary}) + {symbol: summary.type.reference, metadata: null, type: summary}); } } } diff --git a/packages/core/test/linker/jit_summaries_integration_spec.ts b/packages/core/test/linker/jit_summaries_integration_spec.ts index f3a85f6185..dded12c530 100644 --- a/packages/core/test/linker/jit_summaries_integration_spec.ts +++ b/packages/core/test/linker/jit_summaries_integration_spec.ts @@ -229,10 +229,11 @@ export function main() { const overwrittenValue = {}; - TestBed.overrideProvider(SomeDep, {useFactory: () => overwrittenValue, deps: []}); + const fixture = + TestBed.overrideProvider(SomeDep, {useFactory: () => overwrittenValue, deps: []}) + .configureTestingModule({providers: [SomeDep], imports: [SomeModule]}) + .createComponent(SomePublicComponent); - const fixture = TestBed.configureTestingModule({providers: [SomeDep], imports: [SomeModule]}) - .createComponent(SomePublicComponent); expect(fixture.componentInstance.dep).toBe(overwrittenValue); }); diff --git a/packages/core/testing/src/test_bed.ts b/packages/core/testing/src/test_bed.ts index 006d74c26d..f71f4f6648 100644 --- a/packages/core/testing/src/test_bed.ts +++ b/packages/core/testing/src/test_bed.ts @@ -163,8 +163,8 @@ export class TestBed implements Injector { static overrideProvider(token: any, provider: { useFactory: Function, deps: any[], - }): void; - static overrideProvider(token: any, provider: {useValue: any;}): void; + }): typeof TestBed; + static overrideProvider(token: any, provider: {useValue: any;}): typeof TestBed; static overrideProvider(token: any, provider: { useFactory?: Function, useValue?: any, @@ -503,7 +503,7 @@ export class TestBed implements Injector { overrideTemplateUsingTestingModule(component: Type, template: string) { this._assertNotInstantiated('overrideTemplateUsingTestingModule', 'override template'); - @Component({selector: 'empty', template: template}) + @Component({selector: 'empty', template}) class OverrideComponent { } diff --git a/packages/platform-browser/test/testing_public_spec.ts b/packages/platform-browser/test/testing_public_spec.ts index e0abb0319f..62e22ec307 100644 --- a/packages/platform-browser/test/testing_public_spec.ts +++ b/packages/platform-browser/test/testing_public_spec.ts @@ -752,15 +752,15 @@ export function main() { /Cannot override template when the test module has already been instantiated/); }); - it('should reset overrides when the testing modules is resetted', () => { + it('should reset overrides when the testing module is resetted', () => { @Component({selector: 'comp', template: 'a'}) class MyComponent { } TestBed.overrideTemplateUsingTestingModule(MyComponent, 'b'); - TestBed.resetTestingModule(); - const fixture = TestBed.configureTestingModule({declarations: [MyComponent]}) + const fixture = TestBed.resetTestingModule() + .configureTestingModule({declarations: [MyComponent]}) .createComponent(MyComponent); expect(fixture.nativeElement).toHaveText('a'); }); diff --git a/tools/public_api_guard/core/testing.d.ts b/tools/public_api_guard/core/testing.d.ts index 68b635427f..bb02e167ee 100644 --- a/tools/public_api_guard/core/testing.d.ts +++ b/tools/public_api_guard/core/testing.d.ts @@ -118,10 +118,10 @@ export declare class TestBed implements Injector { static overrideProvider(token: any, provider: { useFactory: Function; deps: any[]; - }): void; + }): typeof TestBed; static overrideProvider(token: any, provider: { useValue: any; - }): void; + }): typeof TestBed; static overrideTemplate(component: Type, template: string): typeof TestBed; static overrideTemplateUsingTestingModule(component: Type, template: string): typeof TestBed; /** @experimental */ static resetTestEnvironment(): void;