我的supertest /磁带测试文件如下所示:
var test = require('tape');
var app = require('../../api');
var agent = require('supertest').agent
var supertestCompatibleServer = agent(app.callback());
test('GET /Campus.svc', function (t) {
supertestCompatibleServer
.get('/Campus.svc')
.expect(200)
.expect('Content-Type', /json/)
.end(function (err, res) {
t.ifError(err, 'No error');
t.end();
});
});是什么导致测试挂起,以及我如何修复它?
发布于 2016-04-24 16:28:55
这与这个问题有关:https://github.com/substack/tape/issues/216
在我的例子中,通过knex的数据库连接仍然是打开的,这导致节点进程的完成。解决方案是在拆卸测试中显式调用knex.destroy()。
https://stackoverflow.com/questions/36819345
复制相似问题