1
私はchaiモジュールを使ってコードをテストしています。私はにconsole.log(RES)は、関数正しいか間違っているモカとチャイによるテスト
私はchaiモジュールを使ってコードをテストしています。私はにconsole.log(RES)は、関数正しいか間違っているモカとチャイによるテスト
を知っているので、私はできる結果を表示したい
var CONFIG = require('./config');
var chai = require('chai');
var chaiHttp = require('chai-http');
var should = chai.should();
var server = CONFIG.apiPath;
chai.use(chaiHttp);
describe('TEST', function() {
it('getAllLandingPage completed',function(){
chai.request(server)
.get('getAllLandingPage')
.end(function(err, res){
res.should.have.status(200);
console.log('res: ', res) // not show
done();
});
});
});
あなたがit
のコールバック関数でdone
を逃すようで、
it('getAllLandingPage completed',function(done){
chai.request(server)
.get('getAllLandingPage')
.end(function(err, res){
if (err)
done(err);
else {
res.should.have.status(200);
console.log(res)
done();
}
});
});
ああ。ありがとうございました。それを私が直した。 –