Meteor Jasmine:服务器单元存根错误

Meteor Jasmine:服务器单元存根错误,meteor,jasmine,velocity,Meteor,Jasmine,Velocity,在tests/jasmine/server/unit/z-collection-stubs.js中,我有 在tests/jasmine/server/z-collection2.js中,我有 我得到的错误 W20150326-10:55:08.089(-5)? (STDERR) [sanjo:jasmine]: The file "/home/jimmie/Documents/project/lib/collections/match.js" has syntax errors. [TypeEr

在tests/jasmine/server/unit/z-collection-stubs.js中,我有

在tests/jasmine/server/z-collection2.js中,我有

我得到的错误

W20150326-10:55:08.089(-5)? (STDERR) [sanjo:jasmine]: The file "/home/jimmie/Documents/project/lib/collections/match.js" has syntax errors. [TypeError: Object [object Object] has no method '_ensureIndex']
I20150326-10:55:08.091(-5)? [sanjo:jasmine]: loading source file: /home/jimmie/Documents/project/lib/collections/user.js
W20150326-10:55:08.091(-5)? (STDERR) [sanjo:jasmine]: The file "/home/jimmie/Documents/project/lib/collections/messaging.js" has syntax errors. [TypeError: Object [object Object] has no method '_ensureIndex']
I20150326-10:55:08.093(-5)? [sanjo:jasmine]: loading source file: /home/jimmie/Documents/project/lib/routes/config.js
W20150326-10:55:08.093(-5)? (STDERR) [sanjo:jasmine]: The file "/home/jimmie/Documents/project/lib/collections/user.js" has syntax errors. [TypeError: Object [object Object] has no method 'attachSchema']

因此,似乎我的存根设置不正确,尽管它们似乎是在测试之前加载的。

好的,我有两个问题

首先,我本应该使用的原型是

Mongo.Collection
这些文件需要位于test/jasmine/server/unit/中,以获得正确的加载顺序


我不确定需要什么才能同时为客户端和服务器提供正确的加载顺序和存根。

大多数时候,当您看到这些语法错误时,这是因为jasmine server unit正在尝试运行客户端代码,或者客户端unit尝试运行服务器代码。由于这些文件位于/lib中,因此客户端和服务器镜像都将加载它。此外,在单元模式下,jasmine会存根一堆东西,所以它可能试图在代码中运行它已经存根的东西,因此它会出错。
W20150326-10:55:08.089(-5)? (STDERR) [sanjo:jasmine]: The file "/home/jimmie/Documents/project/lib/collections/match.js" has syntax errors. [TypeError: Object [object Object] has no method '_ensureIndex']
I20150326-10:55:08.091(-5)? [sanjo:jasmine]: loading source file: /home/jimmie/Documents/project/lib/collections/user.js
W20150326-10:55:08.091(-5)? (STDERR) [sanjo:jasmine]: The file "/home/jimmie/Documents/project/lib/collections/messaging.js" has syntax errors. [TypeError: Object [object Object] has no method '_ensureIndex']
I20150326-10:55:08.093(-5)? [sanjo:jasmine]: loading source file: /home/jimmie/Documents/project/lib/routes/config.js
W20150326-10:55:08.093(-5)? (STDERR) [sanjo:jasmine]: The file "/home/jimmie/Documents/project/lib/collections/user.js" has syntax errors. [TypeError: Object [object Object] has no method 'attachSchema']
Mongo.Collection