【发布时间】:2021-03-01 21:17:42
【问题描述】:
编辑:我在 Angular 上打开了一个问题,他们更新了文档:https://github.com/angular/angular/issues/39740
在 Angular 测试中,通常的做法是为 beforeEach 方法执行此操作
beforeEach(waitForAsync(() => {
TestBed
.configureTestingModule({
declarations: [BannerComponent],
})
.compileComponents(); // compile template and css
}));
跟下面做有什么区别?
beforeEach(async () => {
await TestBed
.configureTestingModule({
declarations: [BannerComponent],
})
.compileComponents(); // compile template and css
});
我试图在文档中找到解释,但无法弄清楚。
https://angular.io/api/core/testing/waitForAsync#description https://v10.angular.io/guide/testing-components-scenarios#the-async-beforeeach
【问题讨论】:
标签: angular testing async-await