Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silence Logs in debug mode of Karma browser #3445

Closed
chrisdel101 opened this issue Aug 1, 2018 · 4 comments
Closed

Silence Logs in debug mode of Karma browser #3445

chrisdel101 opened this issue Aug 1, 2018 · 4 comments
Labels
status: needs mcve a defect report needing more information; subject to closing due to inactivity

Comments

@chrisdel101
Copy link

chrisdel101 commented Aug 1, 2018

Description

In the Karma debug console there are lines of useless output. This is traced to the module. I`d like to know how to fix this.

Steps to Reproduce

Once Karma is running, open debug console in browser and logs appear (see image)

It seems to be this piece in moch.js. If comment out the logs, things work as expected. (line 6959 for me)

BrowserStdout.prototype._write = function(chunks, encoding, cb) {
  var output = chunks.toString ? chunks.toString() : chunks
  if (this.label === false) {
    console.log(output)
  } else {
    console.log(this.label+':', output)
  }
  process.nextTick(cb)
}

How would I deal with fixing this permanently so I don`t see these logs? I'm not sure how to do this, or if it is possible, or if this is an issue on my end how I can solve it.

image 1

@outsideris
Copy link
Contributor

I tried with mocha browser tests like npm start test.browser.bdd.

2018-08-04 16 18 49

I can't reproduce it. Can you provide mcvc?

@outsideris outsideris added the status: needs mcve a defect report needing more information; subject to closing due to inactivity label Aug 4, 2018
@Bamieh Bamieh added the stale this has been inactive for a while... label Sep 18, 2018
@plroebuck
Copy link
Contributor

plroebuck commented Sep 19, 2018

When #3477 is merged, the stdout: prefix will disappear from output.
He didn't specify what version of Mocha, OS, platform, etc. which makes debugging the problem rather hopeless.

But he is running the NyanCat reporter above which spews Terminal escape codes for a living.

@chrisdel101, does your problem improve if you specify --reporter min or --reporter spec?
Use of --no-color option might reduce output further.

@stale stale bot removed the stale this has been inactive for a while... label Sep 19, 2018
@chrisdel101
Copy link
Author

chrisdel101 commented Sep 19, 2018

I added the additional NyanCat reporter flag to try and see if it did anything, or it the reporters did anything to the output. They did not, that I could see.
It was still giving those output logs before I added that though.

I've commented out the line in question in mocha.js to fix this for now, and it makes it useable.

I checked with my teammates and we have these logs happening so it's something that needs investigation here. I am closing this as I cannot provide the investigation necessary now (and apologies for not providing enough info about OS etc to begin with). Thanks!

@plroebuck
Copy link
Contributor

Full Disclosure: never used Karma

From quick glance, these "karma.conf.js" configuration options might be applicable.

  • browserConsoleLogOptions
  • client.captureConsole
  • detached

Your "patch" disables all output sent to stdout when run in browser.

Good luck and let us know if one of these options resolves your problem (without requiring you to comment out any code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs mcve a defect report needing more information; subject to closing due to inactivity
Projects
None yet
Development

No branches or pull requests

4 participants