Add an option to turn off logging in testing
Is there an existing issue that is already proposing this?
- [x] I have searched the existing issues
Is your feature request related to a problem? Please describe it
I see that here logger is explicitly turned off.
export interface CommanderOptionsType
extends Omit<CommandFactoryRunOptions, 'logger'> {
pluginsAvailable?: boolean;
}
Though it would be really nice if, at least in testing, we could set logger: false so that unneeded lines won't spawn
Describe the solution you'd like
If logger variable was hidden for a reason, maybe there's an option to pass false to it still? Or come up with another variable?
Teachability, documentation, adoption, migration strategy
No response
What is the motivation / use case for changing the behavior?
Would be nice to write tests with expected errors that don't clog the console
Apologies for the delay in response. So funny enough, it's turned off so that it can be set to false inside of the CommandFactory. I'm guessing I may have forgotten that within the context of the test factory, that or something else is happening. I'll take a look at it here soon
Can you provide a reproduction of this happening? I'm not seeing it do that in the tests of the repository
Ugh, so I've been writing this example
But now I have a problem where turning off logger in test Fastify application doesn't work, the logs are still being generated, and I can't figure out why it works with the real project I had been working on in January, and does not here.
Now I'm not even sure if I'm even supposed to handle logger like this in tests, and if this issue has any point.