Stub npmlog in integration tests

This commit is contained in:
Tankred Hase 2017-08-15 16:12:51 +08:00
parent e9251d5203
commit d8039ea976

View File

@ -5,6 +5,7 @@ const Mongo = require('../../src/dao/mongo');
const nodemailer = require('nodemailer'); const nodemailer = require('nodemailer');
const config = require('config'); const config = require('config');
const fs = require('fs'); const fs = require('fs');
const log = require('npmlog');
describe('Koa App (HTTP Server) Integration Tests', function() { describe('Koa App (HTTP Server) Integration Tests', function() {
this.timeout(20000); this.timeout(20000);
@ -35,6 +36,8 @@ describe('Koa App (HTTP Server) Integration Tests', function() {
use() {} use() {}
}); });
sinon.stub(log);
global.testing = true; global.testing = true;
const init = require('../../src/app'); const init = require('../../src/app');
app = yield init(); app = yield init();
@ -47,6 +50,7 @@ describe('Koa App (HTTP Server) Integration Tests', function() {
}); });
after(function *() { after(function *() {
sinon.restore(log);
nodemailer.createTransport.restore(); nodemailer.createTransport.restore();
yield mongo.clear(DB_TYPE_PUB_KEY); yield mongo.clear(DB_TYPE_PUB_KEY);
yield mongo.clear(DB_TYPE_USER_ID); yield mongo.clear(DB_TYPE_USER_ID);