2017-09-25 42 views
3

我覆盖率记者未能检测到,如果他们在测试过程中把fakeAsync()内使用的语句:角2 - 噶报道记者惦记内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); 
     }); 
    }); 
}); 

会造成业力报告

STA没有覆盖并降低覆盖率。

我该如何解决这个问题?

+0

@yurzui解决了它,谢谢,随时提交作为答案 – deek

回答

1

看起来你错了。正确的语法应该是:

it('Some description', fakeAsync(() => { 
    expect(comp.countWords('butt heaven')).toBe(2); 
}));