4

I'm building an Express.js API and I'm using mocha and supertest for testing.

However, take a look at this:

  root path
GET / 200 5.789 ms - 19
    ✓ returns 200 status code 
GET / 200 0.787 ms - 19
    ✓ returns json mime type 
GET / 200 0.382 ms - 19
    ✓ contains the package version

I want to get rid of the GET / 200 log so it can look like this:

  root path
    ✓ returns 200 status code
    ✓ returns json mime type
    ✓ contains the package version

Any ideas?

AstroCB
  • 12,337
  • 20
  • 57
  • 73
brielov
  • 1,887
  • 20
  • 28
  • I don't thing that output is being generated by supertest. Are you using logger middleware in your express app (e.g. `morgan’)? If so can you share the code where you initialize it? – JME Jun 05 '15 at 00:11

1 Answers1

2

[Solved] The output was generated from morgan logger.

The solution was to wrap the middleware like this:

if (app.get('env') === 'development') { app.use(logger('dev')); }

brielov
  • 1,887
  • 20
  • 28