Skip to content

🐛 Bug: Inconsistent Reporter Use of Console and Stdout #2943

Open

Description

The title of this issue is the crux. It appears that the default spec reporter uses console.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.

Some reporters like spec (https://github.com/mochajs/mocha/blob/master/lib/reporters/spec.js#L40) are using console.log, some like dot(

process.stdout.write('\n');
) use stdout.

My use case involves utilizing headless chrome to run mocha tests. I'm providing a proxy to window.mocha.process.stdout to use a message bus that I've injected, that pipes raw messages back to the node app which catches them via the Chrome DevTools Protocol. It might sound complex, but it's rather simple. Without knowing which actor (user code or mocha) is calling console.log, I can't effectively show console messages in the terminal with any distinction between actors.

The "simple" fix would be to standardize all reports on one output method - preferably mocha.process.stdout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    semver-patchimplementation requires increase of "patch" version number; "bug fixes"status: accepting prsMocha can use your help with this one!type: choregenerally involving deps, tooling, configuration, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions