【发布时间】:2013-12-26 13:44:31
【问题描述】:
我正在尝试使用 tsUnit 为 Typescript 运行单元测试。我已经包含了 tsUnit 路径。我的导入方式似乎有问题。
///<reference path="tsUnit.ts" />
import testClass = tsUnit;
class IDTest extends tsUnit.TestClass {
selectIDTest() {
...
this.areIdentical("#" + id, idSelector);
}
setAsRootTest() {
...
this.areIdentical("root", target.setAsRoot());
}
}
var test = new tsUnit.Test();
test.addTestClass(new IDTest());
test.showResults(document.getElementById('results'), test.run());
这是错误:
Uncaught ReferenceError: tsUnit is not defined IDTest.ts:8:21
(anonymous function) IDTest.ts:8:21
Uncaught SyntaxError: Unexpected token : chrome-extension://mgjjeipcdnnjhgodgjpfkffcejoljijf/shortcut_manager.js
(anonymous function) chrome-extension://mgjjeipcdnnjhgodgjpfkffcejoljijf/shortcut_manager.js
(anonymous function) extensions::messaging
target.(anonymous function) extensions::SafeBuiltins
Event.dispatchToListener extensions::event_bindings
Event.dispatch_ extensions::event_bindings
Event.dispatch extensions::event_bindings
dispatchOnMessage extensions::messaging
【问题讨论】: