[英]Mocha / Chai - Timeout, ensuring promise resolves
关于这个问题有数千个问题,我想我已经阅读了所有问题,但是我仍然不明白为什么以下内容不起作用。
此代码在本地执行没有问题。 在TravisCI上运行时-失败,并确保将done()称为错误。
it('Function oLab.GetObjects & oLab.Deploy', (done) => {
var l = new oLab('1')
l.getObjects().then(function(data){
console.log(data);
expect(data.length).to.above(0);
//There is a bunch of other code in here commented out since this alone doesn't work.
})
.then(() => done(), done)
.catch(function (err) { }); // Not executed
});
我知道getObjects函数失败了:
this.getObjects = function () {
console.log("oLab getObjects function");
return getResources(this.id);
}
该调用getResources:
function getResources(labID){
return db.any('select * from lab_resources where lab_id = ' + labID).then(function(data){
var resources = [];
//Modifies the resources and returns the list. Logging this displays the correct data.
return resources;
})
.catch(function (err) { }); // Not executed
}
问题:
事实证明Travis CI无法访问我请求的数据库,因此数据库连接设置失败。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.