我正在使用meteor 0.6.4.1,laika 0.2.24和node.js 0.10.12。使用tdd进行的测试工作正常,但我尝试使用bdd和laika,但它失败了。我下载了这个演示项目https://github.com/zvictor/laika-extended-example但也失败了。我用mocha做了一个简单的测试,并且应该(只有node.js,而不是meteor)并且工作正常。这是我在演示项目中遇到的错误:
module.js:340
throw err;
^
Error: Cannot find module 'should'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Users/camilo/Documents/Pruebas/Meteor/laika-extended-example/tests/$setup.js:1:72)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
修改
我使用should
sudo npm install -g should
修改2
基于skishore评论,我使用了npm link should
,现在问题发生了变化。首先,我明白了:
injecting laika...
loading phantomjs...
loading initial app pool...
没有更多的事情发生,所以我尝试用laika -D
查看日志:
[laika log] accepting the following extensions: (js)
injecting laika...
loading phantomjs...
[app touch log] [[[[[ ~/Documents/Pruebas/Meteor/laika-extended-example ]]]]]
[app touch log] => Meteor server running on: http://localhost:20472/
loading initial app pool...
[laika log] using nodejs bin(from meteor): /Users/camilo/.meteor/tools/11f45b3996/bin/node
[server log]
[server log] /Users/camilo/Documents/Pruebas/Meteor/laika-extended-example/.meteor/local/build/server/server.js:325
}).run();
^
[server log] ReferenceError: module is not defined
at app/node_modules/should/lib/eql.js:5:1
at /Users/camilo/Documents/Pruebas/Meteor/laika-extended-example/.meteor/local/build/server/server.js:286:12
at Array.forEach (native)
at Function._.each._.forEach (/Users/camilo/.meteor/tools/11f45b3996/lib/node_modules/underscore/underscore.js:79:11)
at run (/Users/camilo/Documents/Pruebas/Meteor/laika-extended-example/.meteor/local/build/server/server.js:227:7)
答案 0 :(得分:0)
来自Github的自述文件:你需要安装应该。使用npm:
sudo npm install -g should