我正在尝试使用 mocha 对外部 HTTP 资源进行简单测试。这是我的代码:
describe('bing.com', function() {
it('should return 200 for a GET request', function() {
var requestify = require('requestify');
requestify.get('http://bing.com')
.then(function(response) {
// Get the response body (JSON parsed or jQuery object for XMLs)
console.log(response.getBody());
done();
});
});
});
测试只是说通过了,但我的console.log
电话从未显示。mocha 是否在收到 http 响应之前完成?