我正在使用流星 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,而不是流星)并且工作正常。这是我在演示项目中遇到的错误:
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
根据滑雪评论,我使用过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)