Skip to content

Commit c21f038

Browse files
committed
test: Add provideZoneChangeDetection to fakeAsync tests.
This commit adds `provideZoneChangeDetection()` to the `beforeEach` block in `fakeAsync_spec.ts` files to ensure proper zone change detection in tests.
1 parent aeda497 commit c21f038

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

packages/angular/build/src/builders/karma/tests/behavior/fake-async_spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,14 @@ describeKarmaBuilder(execute, KARMA_BUILDER_INFO, (harness, setupTarget) => {
3535
}
3636
}`,
3737
'./src/app/app.component.spec.ts': `
38+
import { provideZoneChangeDetection } from '@angular/core';
3839
import { TestBed, fakeAsync, tick } from '@angular/core/testing';
3940
import { By } from '@angular/platform-browser';
4041
import { AppComponent } from './app.component';
4142
4243
describe('AppComponent', () => {
4344
beforeEach(() => TestBed.configureTestingModule({
45+
providers: [provideZoneChangeDetection()],
4446
declarations: [AppComponent]
4547
}));
4648

packages/angular_devkit/build_angular/src/builders/karma/tests/behavior/fake-async_spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,14 @@ describeKarmaBuilder(execute, KARMA_BUILDER_INFO, (harness, setupTarget) => {
3535
}
3636
}`,
3737
'./src/app/app.component.spec.ts': `
38+
import { provideZoneChangeDetection } from '@angular/core';
3839
import { TestBed, fakeAsync, tick } from '@angular/core/testing';
3940
import { By } from '@angular/platform-browser';
4041
import { AppComponent } from './app.component';
4142
4243
describe('AppComponent', () => {
4344
beforeEach(() => TestBed.configureTestingModule({
45+
providers: [provideZoneChangeDetection()],
4446
declarations: [AppComponent]
4547
}));
4648

0 commit comments

Comments
 (0)