我在使用 TinyTest 时遇到问题。我在下面有一个测试
Tinytest.add('x - template', function (test) {
var t = new Widget("ddd");
test.equal(t.html,"");
});
这个函数在另一个文件中(test.js)
function Widget(html){
this.html = html || "";
}
在我的 package.js 中:
Package.onTest(function(api) {
api.use('tinytest');
api.use('core:widgets');
api.addFiles('client/test.js');
api.addFiles('widgets-tests.js');
});
我可以运行我的测试,但我收到此消息:
x
FAIL
S: template
- exception - message Widget is not defined
ReferenceError: Widget is not defined
at Package (packages/local-test:core:widgets/widgets-tests.js:12:1)
at [object Object].func (packages/tinytest/tinytest.js:636:1)
at packages/tinytest/tinytest.js:406:1
at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
at packages/meteor/timers.js:6:1
at runWithEnvironment (packages/meteor/dynamics_nodejs.js:108:1)
想法?