2015-06-24 81 views
1

我有一个非常简单的API测试用例,使用了回送测试模块。如何关闭strongloop回送测试控制台日志记录?

lt = require('loopback-testing') 
assert = require('assert') 

describe '/profile', -> 
    lt.beforeEach.withApp app 

    lt.describe.whenCalledRemotely 'GET', '/api/profiles/ping', { data: 'test' }, -> 
    lt.it.shouldBeAllowed() 

    it 'should have statusCode 200', -> 
     assert.equal @res.statusCode, 200 

    it 'should have pong response', -> 
     assert.equal @res.body.pong, 'test' 

和测试,我在系统控制台这样的人越来越打印的行结果:

/profile 
    GET /api/profiles/ping 
GET /api/profiles/ping 200 50.639 ms - 15 
     ✓ should be allowed 
GET /api/profiles/ping 200 8.026 ms - 15 
     ✓ should have statusCode 200 
GET /api/profiles/ping 200 3.633 ms - 15 
     ✓ should have pong response 

有没有办法关闭环回测试写这些线系统控制台模块?这简直会影响我的摩卡报告概述。

回答

0

您的应用程序中是否配置了任何日志记录中间件?额外的行看起来像morgan生成的HTTP访问日志。

您需要在运行测试时禁用应用程序中的任何HTTP日志记录中间件。这些说明取决于你如何配置这个中间件,你能否扩展你的问题并描述你的应用程序设置?

相关问题