Skip to content

Commit 3899abf

Browse files
author
anh.pham
committed
fix: correct deprecation message of ngcc-jest-processor
Closes #1411
1 parent 73f81ca commit 3899abf

File tree

96 files changed

+2743
-3420
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+2743
-3420
lines changed

e2e/ast-transformers/ng-jit-transformers/__tests__/bar.component.spec.ts

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,15 @@ import { TestBed, waitForAsync } from '@angular/core/testing';
1616
})
1717
class BarComponent {}
1818

19-
test(
20-
'templateUrl/styleUrls/styles should work',
21-
waitForAsync(() => {
22-
TestBed.configureTestingModule({
23-
declarations: [BarComponent],
24-
});
25-
const fixture = TestBed.createComponent(BarComponent);
26-
fixture.detectChanges();
19+
test('templateUrl/styleUrls/styles should work', waitForAsync(() => {
20+
TestBed.configureTestingModule({
21+
declarations: [BarComponent],
22+
});
23+
const fixture = TestBed.createComponent(BarComponent);
24+
fixture.detectChanges();
2725

28-
const elementToFind = fixture.debugElement.nativeElement.querySelector('p');
29-
expect(elementToFind).toBeDefined();
30-
expect(window.getComputedStyle(elementToFind).color).toEqual('');
31-
expect(window.getComputedStyle(elementToFind).fontSize).toEqual('');
32-
}),
33-
);
26+
const elementToFind = fixture.debugElement.nativeElement.querySelector('p');
27+
expect(elementToFind).toBeDefined();
28+
expect(window.getComputedStyle(elementToFind).color).toEqual('');
29+
expect(window.getComputedStyle(elementToFind).fontSize).toEqual('');
30+
}));

e2e/async/__tests__/async.spec.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,11 @@ describe('async with Angular testing apis', () => {
7373
expect(flag).toBe(true);
7474
}));
7575

76-
test(
77-
'waitForAsync should work',
78-
waitForAsync(() => {
79-
let flag = false;
80-
setTimeout(() => {
81-
flag = true;
82-
expect(flag).toBe(true);
83-
}, 100);
84-
}),
85-
);
76+
test('waitForAsync should work', waitForAsync(() => {
77+
let flag = false;
78+
setTimeout(() => {
79+
flag = true;
80+
expect(flag).toBe(true);
81+
}, 100);
82+
}));
8683
});

e2e/full-ivy-lib/__tests__/full-ivy-lib.spec.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@ describe('Full Ivy library', () => {
55
let fullIvyComponent: FullIvyComponent;
66
let fullIvyService: FullIvyService;
77

8-
beforeEach(
9-
waitForAsync(() => {
10-
TestBed.configureTestingModule({
11-
imports: [FullIvyModule],
12-
});
8+
beforeEach(waitForAsync(() => {
9+
TestBed.configureTestingModule({
10+
imports: [FullIvyModule],
11+
});
1312

14-
fullIvyComponent = TestBed.createComponent(FullIvyComponent).componentInstance;
15-
fullIvyService = TestBed.inject(FullIvyService);
16-
}),
17-
);
13+
fullIvyComponent = TestBed.createComponent(FullIvyComponent).componentInstance;
14+
fullIvyService = TestBed.inject(FullIvyService);
15+
}));
1816

1917
test('should create the component instance', () => {
2018
expect(fullIvyComponent).toBeDefined();

e2e/partial-ivy-lib/__tests__/partial-ivy-lib.spec.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,14 @@ describe('Partial Ivy library', () => {
66
let partialIvyComponent: PartialIvyComponent;
77
let partialIvyService: PartialIvyService;
88

9-
beforeEach(
10-
waitForAsync(() => {
11-
TestBed.configureTestingModule({
12-
imports: [PartialIvyModule, PartialIvyTestingModule],
13-
});
9+
beforeEach(waitForAsync(() => {
10+
TestBed.configureTestingModule({
11+
imports: [PartialIvyModule, PartialIvyTestingModule],
12+
});
1413

15-
partialIvyComponent = TestBed.createComponent(PartialIvyComponent).componentInstance;
16-
partialIvyService = TestBed.inject(PartialIvyService);
17-
}),
18-
);
14+
partialIvyComponent = TestBed.createComponent(PartialIvyComponent).componentInstance;
15+
partialIvyService = TestBed.inject(PartialIvyService);
16+
}));
1917

2018
test('should create the component instance', () => {
2119
expect(partialIvyComponent).toBeDefined();

e2e/snapshot-serializers/__tests__/foo.component.spec.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,14 @@ class FooComponent {
2222
condition2 = false;
2323
}
2424

25-
test(
26-
'snapshot should work',
27-
waitForAsync(() => {
28-
TestBed.configureTestingModule({
29-
declarations: [FooComponent],
30-
});
25+
test('snapshot should work', waitForAsync(() => {
26+
TestBed.configureTestingModule({
27+
declarations: [FooComponent],
28+
});
3129

32-
const fixture = TestBed.createComponent(FooComponent);
33-
fixture.detectChanges();
30+
const fixture = TestBed.createComponent(FooComponent);
31+
fixture.detectChanges();
3432

35-
expect(fixture).toMatchSnapshot();
36-
expect(fixture.debugElement.nativeElement).toMatchSnapshot();
37-
}),
38-
);
33+
expect(fixture).toMatchSnapshot();
34+
expect(fixture.debugElement.nativeElement).toMatchSnapshot();
35+
}));

examples/example-app-v11/src/app/app-initial.component.spec.ts

Lines changed: 21 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,27 @@ import { ComponentFixture } from '@angular/core/testing';
55
import { AppComponent } from './app-initial.component';
66

77
describe('AppComponent (initial CLI version)', () => {
8-
beforeEach(
9-
waitForAsync(() => {
10-
TestBed.configureTestingModule({
11-
declarations: [AppComponent],
12-
}).compileComponents();
13-
}),
14-
);
15-
it(
16-
'should create the app',
17-
waitForAsync(() => {
18-
const fixture = TestBed.createComponent(AppComponent);
19-
const app = fixture.componentInstance;
20-
expect(app).toBeTruthy();
21-
}),
22-
);
23-
it(
24-
`should have as title 'app'`,
25-
waitForAsync(() => {
26-
const fixture = TestBed.createComponent(AppComponent);
27-
const app = fixture.componentInstance;
28-
expect(app.title).toEqual('app');
29-
}),
30-
);
31-
it(
32-
'should render title',
33-
waitForAsync(() => {
34-
const fixture = TestBed.createComponent(AppComponent);
35-
fixture.detectChanges();
36-
const compiled = fixture.nativeElement as HTMLElement;
37-
expect(compiled.querySelector('h1')?.textContent).toContain('Welcome to app!');
38-
}),
39-
);
8+
beforeEach(waitForAsync(() => {
9+
TestBed.configureTestingModule({
10+
declarations: [AppComponent],
11+
}).compileComponents();
12+
}));
13+
it('should create the app', waitForAsync(() => {
14+
const fixture = TestBed.createComponent(AppComponent);
15+
const app = fixture.componentInstance;
16+
expect(app).toBeTruthy();
17+
}));
18+
it(`should have as title 'app'`, waitForAsync(() => {
19+
const fixture = TestBed.createComponent(AppComponent);
20+
const app = fixture.componentInstance;
21+
expect(app.title).toEqual('app');
22+
}));
23+
it('should render title', waitForAsync(() => {
24+
const fixture = TestBed.createComponent(AppComponent);
25+
fixture.detectChanges();
26+
const compiled = fixture.nativeElement as HTMLElement;
27+
expect(compiled.querySelector('h1')?.textContent).toContain('Welcome to app!');
28+
}));
4029
});
4130

4231
describe('AppComponent (initial CLI version - as it should be)', () => {

examples/example-app-v11/src/app/app.component.router.spec.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,12 @@ let router: Router;
2626
let location: SpyLocation;
2727

2828
describe('AppComponent & RouterTestingModule', () => {
29-
beforeEach(
30-
waitForAsync(() => {
31-
void TestBed.configureTestingModule({
32-
imports: [AppModule, RouterTestingModule.withRoutes(routes)],
33-
providers: [{ provide: HeroService, useClass: TestHeroService }],
34-
}).compileComponents();
35-
}),
36-
);
29+
beforeEach(waitForAsync(() => {
30+
void TestBed.configureTestingModule({
31+
imports: [AppModule, RouterTestingModule.withRoutes(routes)],
32+
providers: [{ provide: HeroService, useClass: TestHeroService }],
33+
}).compileComponents();
34+
}));
3735

3836
it('should navigate to "Dashboard" immediately', fakeAsync(() => {
3937
createComponent();

examples/example-app-v11/src/app/app.component.spec.ts

Lines changed: 39 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -21,59 +21,53 @@ let comp: AppComponent;
2121
let fixture: ComponentFixture<AppComponent>;
2222

2323
describe('AppComponent & TestModule', () => {
24-
beforeEach(
25-
waitForAsync(() => {
26-
TestBed.configureTestingModule({
27-
declarations: [
28-
AppComponent,
29-
RouterLinkDirectiveStub,
30-
BannerStubComponent,
31-
RouterOutletStubComponent,
32-
WelcomeStubComponent,
33-
],
34-
})
35-
.compileComponents()
36-
.then(() => {
37-
fixture = TestBed.createComponent(AppComponent);
38-
comp = fixture.componentInstance;
39-
});
40-
}),
41-
);
24+
beforeEach(waitForAsync(() => {
25+
TestBed.configureTestingModule({
26+
declarations: [
27+
AppComponent,
28+
RouterLinkDirectiveStub,
29+
BannerStubComponent,
30+
RouterOutletStubComponent,
31+
WelcomeStubComponent,
32+
],
33+
})
34+
.compileComponents()
35+
.then(() => {
36+
fixture = TestBed.createComponent(AppComponent);
37+
comp = fixture.componentInstance;
38+
});
39+
}));
4240
tests();
4341
});
4442

4543
describe('AppComponent & NO_ERRORS_SCHEMA', () => {
46-
beforeEach(
47-
waitForAsync(() => {
48-
TestBed.configureTestingModule({
49-
declarations: [AppComponent, BannerStubComponent, RouterLinkDirectiveStub],
50-
schemas: [NO_ERRORS_SCHEMA],
51-
})
52-
.compileComponents()
53-
.then(() => {
54-
fixture = TestBed.createComponent(AppComponent);
55-
comp = fixture.componentInstance;
56-
});
57-
}),
58-
);
44+
beforeEach(waitForAsync(() => {
45+
TestBed.configureTestingModule({
46+
declarations: [AppComponent, BannerStubComponent, RouterLinkDirectiveStub],
47+
schemas: [NO_ERRORS_SCHEMA],
48+
})
49+
.compileComponents()
50+
.then(() => {
51+
fixture = TestBed.createComponent(AppComponent);
52+
comp = fixture.componentInstance;
53+
});
54+
}));
5955
tests();
6056
});
6157

6258
describe('AppComponent & AppModule', () => {
63-
beforeEach(
64-
waitForAsync(() => {
65-
TestBed.configureTestingModule({ imports: [AppModule] })
66-
.overrideModule(AppModule, {
67-
remove: { imports: [AppRoutingModule] },
68-
add: { declarations: [RouterLinkDirectiveStub, RouterOutletStubComponent] },
69-
})
70-
.compileComponents()
71-
.then(() => {
72-
fixture = TestBed.createComponent(AppComponent);
73-
comp = fixture.componentInstance;
74-
});
75-
}),
76-
);
59+
beforeEach(waitForAsync(() => {
60+
TestBed.configureTestingModule({ imports: [AppModule] })
61+
.overrideModule(AppModule, {
62+
remove: { imports: [AppRoutingModule] },
63+
add: { declarations: [RouterLinkDirectiveStub, RouterOutletStubComponent] },
64+
})
65+
.compileComponents()
66+
.then(() => {
67+
fixture = TestBed.createComponent(AppComponent);
68+
comp = fixture.componentInstance;
69+
});
70+
}));
7771

7872
tests();
7973
});

examples/example-app-v11/src/app/banner/banner-initial.component.spec.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ describe('BannerComponent (initial CLI generated)', () => {
77
let component: BannerComponent;
88
let fixture: ComponentFixture<BannerComponent>;
99

10-
beforeEach(
11-
waitForAsync(() => {
12-
TestBed.configureTestingModule({ declarations: [BannerComponent] }).compileComponents();
13-
}),
14-
);
10+
beforeEach(waitForAsync(() => {
11+
TestBed.configureTestingModule({ declarations: [BannerComponent] }).compileComponents();
12+
}));
1513

1614
beforeEach(() => {
1715
fixture = TestBed.createComponent(BannerComponent);

examples/example-app-v11/src/app/dashboard/dashboard-hero.component.spec.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,9 @@ describe('DashboardHeroComponent when tested directly', () => {
2727
let heroDe: DebugElement;
2828
let heroEl: HTMLElement;
2929

30-
beforeEach(
31-
waitForAsync(() => {
32-
TestBed.configureTestingModule({ declarations: [DashboardHeroComponent] }).compileComponents();
33-
}),
34-
);
30+
beforeEach(waitForAsync(() => {
31+
TestBed.configureTestingModule({ declarations: [DashboardHeroComponent] }).compileComponents();
32+
}));
3533

3634
beforeEach(() => {
3735
fixture = TestBed.createComponent(DashboardHeroComponent);
@@ -92,11 +90,9 @@ describe('DashboardHeroComponent when inside a test host', () => {
9290
let fixture: ComponentFixture<TestHostComponent>;
9391
let heroEl: HTMLElement;
9492

95-
beforeEach(
96-
waitForAsync(() => {
97-
TestBed.configureTestingModule({ declarations: [DashboardHeroComponent, TestHostComponent] }).compileComponents();
98-
}),
99-
);
93+
beforeEach(waitForAsync(() => {
94+
TestBed.configureTestingModule({ declarations: [DashboardHeroComponent, TestHostComponent] }).compileComponents();
95+
}));
10096

10197
beforeEach(() => {
10298
fixture = TestBed.createComponent(TestHostComponent);

0 commit comments

Comments
 (0)