我正在使用jasmine编写测试,并且我有许多工作测试不使用表示dom元素的类型。
现在,我已经编写了一个可以简化为以下内容的测试:
describe("A Test",
() => {
it("when an element is created then it is defined",
() => {
const element = new SVGGElement();
expect(element).toBeDefined();
}
);
}
);当使用jasmine运行测试时,测试失败,出现以下错误:
消息: ReferenceError: SVGGElement未定义堆栈: ReferenceError: SVGGElement未在对象处定义。(C:\Path\Test.spec.ts:50:37)
我看到SVGGElement在两个
所有在使用tsc时都会编译,尽管这种类型没有显式导入。据推测,这是因为tsconfig.json中的以下内容:
"compilerOptions": {
"lib": [ "es6", "dom" ]
}如何配置这些内容,以便能够运行此测试?
发布于 2017-09-12 01:12:41
https://stackoverflow.com/questions/46160546
复制相似问题