流星测试:尝试导入时出错

时间:2016-04-05 15:11:54

标签: testing meteor

我正试图测试流星应用程序,就像在流星网站的角度教程中一样 https://www.meteor.com/tutorials/angular/testing

但是当我添加导入行

import { Meteor } from 'meteor/meteor';

我运行流星测试,我收到此错误:

W20160405-15:13:36.894(0)? (STDERR)
W20160405-15:13:36.894(0)? (STDERR) C:\Users\ys\AppData\Local\.meteor\packages\meteor-tool\1.3.1-rc.3\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules\fibers\future.js:245
W20160405-15:13:36.895(0)? (STDERR)                                             throw(ex);
W20160405-15:13:36.895(0)? (STDERR)                                                   ^
W20160405-15:13:36.895(0)? (STDERR) ReferenceError: require is not defined
W20160405-15:13:36.896(0)? (STDERR)     at app\testing\add.test.js:5:21
W20160405-15:13:36.896(0)? (STDERR)     at app\testing\add.test.js:21:4
W20160405-15:13:36.896(0)? (STDERR)     at C:\Users\ys\AppData\Local\Temp\meteor-test-runxjisnu\.meteor\local\build\programs\server\boot.js:283:10
W20160405-15:13:36.896(0)? (STDERR)     at Array.forEach (native)
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.
W20160405-15:13:36.896(0)? (STDERR)     at Function._.each._.forEach (C:\Users\ys\AppData\Local\.meteor\packages\meteor-tool\1.3.1-rc.3\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules\underscore\underscore.js:79:11)
W20160405-15:13:36.897(0)? (STDERR)     at C:\Users\ys\AppData\Local\Temp\meteor-test-runxjisnu\.meteor\local\build\programs\server\boot.js:133:5

当我删除导入行时,测试按原样运行,但是没有导入“chai”(或类似的模块),我不知道如何使断言功能起作用。

0 个答案:

没有答案