我正在尝试运行我的Sails单元测试(使用mocha和istanbul)。
当运行时,...
我遇到了错误。
安装似乎找不到我的Sails...但是正在进行。
我明白了。
“and running sails lift works fine” 的意思是“运行 sails lift 没问题”。
“Here is the mocha tests file in my project”的意思是“这是我的项目中的 mocha 测试文件”。
当运行时,...
grunt test
我遇到了错误。
1) "before all" hook
2) "after all" hook
0 passing (5s)
2 failing
1) "before all" hook:
Error: timeout of 2000ms exceeded
at null.<anonymous> (/vagrant/node_modules/mocha/lib/runnable.js:157:19)
at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)
2) "after all" hook:
ReferenceError: sails is not defined
安装似乎找不到我的Sails...但是正在进行。
which sails
我明白了。
/usr/local/node/node-default/bin/sails
“and running sails lift works fine” 的意思是“运行 sails lift 没问题”。
“Here is the mocha tests file in my project”的意思是“这是我的项目中的 mocha 测试文件”。
//boostrap.test.js
var Sails = require('sails');
before(function(done) {
Sails.lift({
// configuration for testing purposes
}, function(err, sails) {
if (err) return done(err);
// here you can load fixtures, etc.
done(err, sails);
});
});
after(function(done) {
// here you can clear fixtures, etc.
sails.lower(done);
});