我下面this tutorial from angular.io角2单元测试:找不到名称“描述”
正如他们所说,我创建hero.spec.ts文件创建单元测试:
import { Hero } from './hero';
describe('Hero',() => {
it('has name',() => {
let hero: Hero = {id: 1, name: 'Super Cat'};
expect(hero.name).toEqual('Super Cat');
});
it('has id',() => {
let hero: Hero = {id: 1, name: 'Super Cat'};
expect(hero.id).toEqual(1);
});
});
单位测试工作就像一个魅力。问题是:我看到一些错误,这是在教程中提到:
我们的编辑器和编译器可能会抱怨说,他们不知道什么
it
和expect
是因为他们缺乏描述 茉莉花打字文件。我们现在可以忽略那些烦人的投诉,因为它们是无害的。
而且他们确实忽略了它。即使这些错误是无害的,当我收到一堆错误时,它在我的输出控制台中看起来不太好。是我所得到
例子:
找不到名称 '描述'。
找不到'it'这个名字。
找不到'expect'的名字。
我该怎么办才能修复它?
你可以在Github上来修复这个bug:https://github.com/TypeStrong/atom-typescript/issues/1125 –