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

refactor(core): remove deprecated aotSummaries fields in TestBed config #45487

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 0 additions & 4 deletions aio/content/guide/deprecations.md
Expand Up @@ -74,8 +74,6 @@ v14 - v17
| `@angular/core` | [Factory-based signature of `ViewContainerRef.createComponent`](api/core/ViewContainerRef#createComponent) | <!-- v13 --> v15 |
| `@angular/core/testing` | [`TestBed.get`](#testing) | <!-- v9 --> v12 |
| `@angular/core/testing` | [`async`](#testing) | <!-- v9 --> v12 |
| `@angular/core/testing` | [`aotSummaries` argument in `TestBed.initTestEnvironment`](#testing) | <!-- v13 --> v14 |
| `@angular/core/testing` | [`aotSummaries` field of the `TestModuleMetadata` type](#testing) | <!-- v13 --> v14 |
| `@angular/forms` | [`FormBuilder.group` legacy options parameter](api/forms/FormBuilder#group) | <!-- v11 --> v14 |
| `@angular/platform-server` | [`renderModuleFactory`](#platform-server) | <!-- v13 --> v15 |
| `@angular/router` | [`relativeLinkResolution`](#relativeLinkResolution) | <!-- v14 --> v16 |
Expand Down Expand Up @@ -148,8 +146,6 @@ In the [API reference section](api) of this site, deprecated APIs are indicated
|:--- |:--- |:--- |:--- |
| [`TestBed.get`](api/core/testing/TestBed#get) | [`TestBed.inject`](api/core/testing/TestBed#inject) | v9 | Same behavior, but type safe. |
| [`async`](api/core/testing/async) | [`waitForAsync`](api/core/testing/waitForAsync) | v10 | Same behavior, but rename to avoid confusion. |
| [`aotSummaries` argument in `TestBed.initTestEnvironment`](api/core/testing/TestBed#inittestenvironment) | No replacement needed | v13 | Summary files are unused in Ivy. |
| [`aotSummaries` field of the `TestModuleMetadata` type](api/core/testing/TestModuleMetadata) | No replacement needed | v13 | Summary files are unused in Ivy. |

<a id="platform-browser-dynamic"></a>

Expand Down
4 changes: 2 additions & 2 deletions aio/tests/e2e/src/api-pages.e2e-spec.ts
Expand Up @@ -79,11 +79,11 @@ describe('Api pages', () => {

it('should show all overloads of interface methods', async () => {
await page.navigateTo('api/core/testing/TestBedStatic');
expect(await (await page.getInstanceMethodOverloads('initTestEnvironment')).length).toEqual(2);
expect(await (await page.getInstanceMethodOverloads('inject')).length).toEqual(2);
});

it('should show all overloads of pseudo-class methods', async () => {
await page.navigateTo('api/core/testing/TestBed');
expect(await (await page.getInstanceMethodOverloads('initTestEnvironment')).length).toEqual(2);
expect(await (await page.getInstanceMethodOverloads('inject')).length).toEqual(2);
});
});
7 changes: 0 additions & 7 deletions goldens/public-api/core/testing/index.md
Expand Up @@ -114,8 +114,6 @@ export interface TestBed {
// @deprecated (undocumented)
get(token: any, notFoundValue?: any): any;
initTestEnvironment(ngModule: Type<any> | Type<any>[], platform: PlatformRef, options?: TestEnvironmentOptions): void;
// @deprecated
initTestEnvironment(ngModule: Type<any> | Type<any>[], platform: PlatformRef, aotSummaries?: () => any[]): void;
// (undocumented)
inject<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): T;
// (undocumented)
Expand Down Expand Up @@ -173,8 +171,6 @@ export interface TestBedStatic {
// @deprecated (undocumented)
get(token: any, notFoundValue?: any): any;
initTestEnvironment(ngModule: Type<any> | Type<any>[], platform: PlatformRef, options?: TestEnvironmentOptions): TestBed;
// @deprecated
initTestEnvironment(ngModule: Type<any> | Type<any>[], platform: PlatformRef, aotSummaries?: () => any[]): TestBed;
// (undocumented)
inject<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): T;
// (undocumented)
Expand Down Expand Up @@ -219,8 +215,6 @@ export class TestComponentRenderer {

// @public (undocumented)
export interface TestEnvironmentOptions {
// @deprecated
aotSummaries?: () => any[];
teardown?: ModuleTeardownOptions;
}

Expand All @@ -230,7 +224,6 @@ export type TestModuleMetadata = {
declarations?: any[];
imports?: any[];
schemas?: Array<SchemaMetadata | any[]>;
aotSummaries?: () => any[];
teardown?: ModuleTeardownOptions;
};

Expand Down
11 changes: 4 additions & 7 deletions packages/core/testing/src/r3_test_bed.ts
Expand Up @@ -80,9 +80,9 @@ export class TestBedRender3 implements TestBed {
*/
static initTestEnvironment(
ngModule: Type<any>|Type<any>[], platform: PlatformRef,
summariesOrOptions?: TestEnvironmentOptions|(() => any[])): TestBed {
options?: TestEnvironmentOptions): TestBed {
const testBed = _getTestBedRender3();
testBed.initTestEnvironment(ngModule, platform, summariesOrOptions);
testBed.initTestEnvironment(ngModule, platform, options);
return testBed;
}

Expand Down Expand Up @@ -230,15 +230,12 @@ export class TestBedRender3 implements TestBed {
*/
initTestEnvironment(
ngModule: Type<any>|Type<any>[], platform: PlatformRef,
summariesOrOptions?: TestEnvironmentOptions|(() => any[])): void {
options?: TestEnvironmentOptions): void {
if (this.platform || this.ngModule) {
throw new Error('Cannot set base providers because it has already been called');
}

// If `summariesOrOptions` is a function, it means that it's
// an AOT summaries factory which Ivy doesn't support.
TestBedRender3._environmentTeardownOptions =
typeof summariesOrOptions === 'function' ? undefined : summariesOrOptions?.teardown;
TestBedRender3._environmentTeardownOptions = options?.teardown;

this.platform = platform;
this.ngModule = ngModule;
Expand Down
16 changes: 0 additions & 16 deletions packages/core/testing/src/test_bed.ts
Expand Up @@ -35,22 +35,6 @@ export interface TestBed {
initTestEnvironment(
ngModule: Type<any>|Type<any>[], platform: PlatformRef,
options?: TestEnvironmentOptions): void;
/**
* Initialize the environment for testing with a compiler factory, a PlatformRef, and an
* angular module. These are common to every test in the suite.
*
* This may only be called once, to set up the common providers for the current test
* suite on the current platform. If you absolutely need to change the providers,
* first use `resetTestEnvironment`.
*
* Test modules and platforms for individual platforms are available from
* '@angular/<platform_name>/testing'.
*
* @deprecated This API that allows providing AOT summaries is deprecated, since summary files are
* unused in Ivy.
*/
initTestEnvironment(
ngModule: Type<any>|Type<any>[], platform: PlatformRef, aotSummaries?: () => any[]): void;

/**
* Reset the providers for the test injector.
Expand Down
27 changes: 0 additions & 27 deletions packages/core/testing/src/test_bed_common.ts
Expand Up @@ -44,24 +44,13 @@ export type TestModuleMetadata = {
declarations?: any[],
imports?: any[],
schemas?: Array<SchemaMetadata|any[]>,
/**
* @deprecated With Ivy, AOT summary files are unused.
*/
aotSummaries?: () => any[],
teardown?: ModuleTeardownOptions;
};

/**
* @publicApi
*/
export interface TestEnvironmentOptions {
/**
* Provides a way to specify AOT summaries to use in TestBed.
* This parameter is unused and deprecated in Ivy.
*
* @deprecated With Ivy, AOT summary files are unused.
*/
aotSummaries?: () => any[];
/**
* Configures the test module teardown behavior in `TestBed`.
*/
Expand Down Expand Up @@ -102,22 +91,6 @@ export interface TestBedStatic {
initTestEnvironment(
ngModule: Type<any>|Type<any>[], platform: PlatformRef,
options?: TestEnvironmentOptions): TestBed;
/**
* Initialize the environment for testing with a compiler factory, a PlatformRef, and an
* angular module. These are common to every test in the suite.
*
* This may only be called once, to set up the common providers for the current test
* suite on the current platform. If you absolutely need to change the providers,
* first use `resetTestEnvironment`.
*
* Test modules and platforms for individual platforms are available from
* '@angular/<platform_name>/testing'.
*
* @deprecated This API that allows providing AOT summaries is deprecated, since summary files are
* unused in Ivy.
*/
initTestEnvironment(
ngModule: Type<any>|Type<any>[], platform: PlatformRef, aotSummaries?: () => any[]): TestBed;

/**
* Reset the providers for the test injector.
Expand Down