Hide HTTP request logs in tests

I have an API running in production, and i have all the tests in my repository.

When i run adonis test this is the output (one of the tests)


This project is working fine, but, yesterday i create a brand new project, and i’m writing tests for it, but when i run adonis test this is the output

Every request is beign logged in my console… How i can hide it in testing environement?

I think you need to re-phrase the question because it lacks information.

I don’t know how to provide more information.

I just need to hide the HTTP logs when i’m running tests.

Well … those HTTP activities are performed by your tests :slight_smile:

But i don’t want to see the logs.

The two images are from different projects, both using Adonis.

In the first project i’m using the same structure to perform the tests, and the HTTP logs aren’t showing.

I don’t know what is different between the projects, but the structure is the same

I figured out how to fix it.

Just add the property loggerEnv: ['development', 'production'] in config/app.js inside http

1 Like

I guess you are clever because this is not mentioned in the documentation.

1 Like

Actually, i found this here https://github.com/adonisjs/adonis-http-logger

In the config section i found the config options

1 Like

Thank you very much for sharing ! Was not aware of this !

1 Like

Maybe @virk can add this to the official docs?

You can suggest your own PR and see if it will be accepted :slight_smile:

1 Like