Skip to content

Commit f6b4657

Browse files
authored
build: ban new usages of fakeAsync (#33946)
Updates the lint rules to avoid adding new usages of `fakeAsync`.
1 parent c0207b5 commit f6b4657

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

‎src/cdk/testing/tests/testbed.spec.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ describe('TestbedHarnessEnvironment', () => {
8787
harness.getTaskStateResult().then(res => expect(res).toBe('result'));
8888
}));
8989

90+
// Testing the integration with fakeAsync.
91+
// tslint:disable-next-line:ban
9092
it('should be able to wait for tasks outside of Angular within fakeAsync test zone', fakeAsync(async () => {
9193
expect(await harness.getTaskStateResult()).toBe('result');
9294
}));
@@ -96,6 +98,8 @@ describe('TestbedHarnessEnvironment', () => {
9698
expect(element.id).toContain('root');
9799
});
98100

101+
// Testing the integration with fakeAsync.
102+
// tslint:disable-next-line:ban
99103
it('should wait for async operation to complete in fakeAsync test', fakeAsync(async () => {
100104
const asyncCounter = await harness.asyncCounter();
101105
expect(await asyncCounter.text()).toBe('5');

‎tslint.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
["fdescribe"],
3737
["xit"],
3838
["xdescribe"],
39+
{"name": ["fakeAsync"], "message": "`fakeAsync` tests are no longer allowed."},
3940
{"name": ["first"], "message": "Use take(1) instead."},
4041
{"name": ["Object", "assign"], "message": "Use the spread operator instead."},
4142
{"name": ["*", "asObservable"], "message": "Cast to Observable type instead."},

0 commit comments

Comments
 (0)