我的报道记者未能检测到在测试期间将其放入fakeAsync()中时使用的语句:
describe('countWords', () => {
it('should total number of words in string; should be 2 for "butt heaven" ', () => {
expect(comp.countWords('butt heaven')).toBe(2);
});
});
检测不到但......
describe('countWords', () => {
it('should total number of words in string; should be 2 for "butt heaven" ', () => {
fakeAsync( () => {
expect(comp.countWords('butt heaven')).toBe(2);
});
});
});
会导致业力报告
声明未涵盖且覆盖率较低。
我该如何解决这个问题?
答案 0 :(得分:1)
看起来你输错了。正确的语法应该是:
it('Some description', fakeAsync(() => {
expect(comp.countWords('butt heaven')).toBe(2);
}));