看其他问题,实在找不到问题的原因。我正在尝试使用摩卡进行测试。
it("Should not do the work",function(done) {
axios
.post("x/y",{ id:a2 })
.then(function(res) {
assert(false,"Should not do the work");
done();
})
.catch(function(res) {
assert.equal(HttpStatus.CONFLICT,res.status);
done();
});
});
it("Should do the work",function(done) {
axios
.post("/x/y",{ id: a1 })
.then(function(res) {
done();
})
.catch(done);
});
结果是:
√ Should not do the work (64ms)
1) Should do the work
1 passing (20s)
1 failing
1) Error: Timeout of 20000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
增加超时不起作用。