Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suppress REST Logging Calls from Supertest

I have started using MEAN stack and currently writing REST unit tests using Super Test

I want to have a little bit more clarity in my log file so that I can easily see my successful and failed tests.

I wish to suppress the console output for the actual rest API call which I think are coming out of SuperTest.

This image shows the logs I want to suppress.

Suppress Super Test Logging

like image 316
David Cruwys Avatar asked Dec 08 '15 06:12

David Cruwys


1 Answers

I think it's actually coming from expressjs/morgan. I've gotten around it by setting the env to test and disabling morgan for the test env.

In my test files:

process.env.NODE_ENV = 'test';

In app.js:

if(app.get('env') !== 'test') app.use(logger('dev'));

like image 93
scottmizo Avatar answered Nov 10 '22 07:11

scottmizo