angular - 如何在角度 4 中运行单元测试特定组件
问题描述
有没有办法只为 angular 4 项目中的特定组件运行单元测试?
解决方案
将 f 添加到describe
关键字以使其集中。使用fdescribe
. 这将只运行焦点组件。
fdescribe('MyComponent', () => {
let component: MyComponent;
let fixture: ComponentFixture<MyComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ MyComponent ]
})
.compileComponents();
}));
it('should be created', () => {
expect(component).toBeTruthy();
});
});
推荐阅读
- c++ - 如何在双向图中找到两条不相交的路径?
- applescript - 如何将“选择文件夹命令”与“添加文件夹项目”功能与 Applescript 结合使用
- reactjs - 通过 React 访问查询参数
- scala - 内存不足错误的 Spark 配置
- objective-c - RPScreenRecorder startCaptureWithHandler:不在样本处理程序中返回麦克风声音
- python - 无法使用 tweepy 转发 - Python
- javascript - 在 Google 翻译 API 上需要帮助
- python - 我错误地卸载了python 2.7,我无法在kali linux(最新版本)中重新安装它
- macos - macOS Mojave 自定义动态壁纸
- python - 谷歌分析在网站上提取当前用户数量