Closed Sayan751 closed 11 months ago
This conflicts with #2943.
It appears that the default
spec
reporter usesconsole.log
rather than the built-in process.stdout that other reporters use. And there doesn't seem to be a pattern to which reporters use which output method.
Per https://github.com/mochajs/mocha/issues/2943#issuecomment-319508521, Mocha is going to move to process.stdout.write
. So this is a wontfix. Sorry to be the bearer of bad news!
Is your feature request related to a problem or a nice-to-have?? Please describe.
While running the tests it happens that there are several
console.log
in the source code. Sometimes those are necessary. However, during the tests, I don't want those log crowding the console, as then it gets difficult to detect whether those logs are intentional or those are actual errors.Describe the solution you'd like
I would like a
logLevel
configuration option. Karma supports this with a configuration option with the same name: http://karma-runner.github.io/4.0/config/configuration-file.html. There one can define how much logging informations are intended. For example, when thelogLevel
is set to 'error', mocha won't show theconsole.log
s in console.Describe alternatives you've considered
The solutions floating around on several GH issues or in SO suggests to replace the
console.log
in the hooks of the suites. But that is a solution, I don't want to go for, as it meddles with the globals. A far desirable solution is to handle is properly in mocha.Additional context