-
Notifications
You must be signed in to change notification settings - Fork 93
Messages written to console.log don't show up in the terminal #47
Comments
I've noticed that I gain the ability to see written to console messages in my terminal back when I comment out the // karma-unit-conf
module.exports = function(config) {
config.set({
... ... ...
logLevel: config.LOG_DEBUG,
// client: {
// mocha: {
// bail: true
// }
// }
});
}; Does this make sense? |
@demisx I would be keen to help out with this issue but there are just way to many dependencies in your project to do it in an efficient manner. Could you please create a minimal repository that exposes the issue? Like remove all the plugins / config options that are not essential to reproducing the issue? We just basically need to have a minimal reproduce scenario that demonstrates an issue in one of the karma plugins. This will make the issue resolution faster. Thnx! |
@pkozlowski-opensource I understand. Here is a stripped down repo to replicate this issue: Instructions are in the readme file. Please let me know if there is anything else I can help with troubleshooting this issue. |
Hi there. Indeed, this fixed the problem. Would be great if docs mentioned this option. I'll see if I can contribute to it. |
🍺 |
is the mocha object necessary to run this? I cannot get this option to run with jasmine. |
@winnemucca no, It should work without |
Likewise, adding the client/captureConsole object doesn't fix the issue for me (also using Jasmine) |
Console.logs in my mocha tests are not showing up in terminal with
|
please make sure to use [email protected] there was a bug in 1.0 |
UPDATE: karma-mocha-reporter should be emitting logs, but isn't due to a bug in karma. The fix for that bug has been merged, so it should start working again with the next release of karma. Consider my suggestion below an ugly workaround in the meantime. See references: In case anyone else is coming across this issue: one possible cause is that you have turned off karma's default reporter. karma's default reporter (called 'progress') captures and re-emits log lines. If you have specified any other reporters, the progress reporter gets turned off unless you re-specify it. As a result, if your karma.conf.js has an entry like this (ours did), you won't see your console.log messages, because neither karma-mocha-reporter nor karma-coverage-reporter emit log lines:
If you just include progress in the list, you should get your console.log messages back, though having both progress and mocha reporters is a bit of a visual mess.
|
karma version:1.1.1 have following in the config:
We are still not being able to see console.logs in the terminal output. |
fix for PhantomJS:
|
My logs work with ... but I seem to be getting loads of logging statements from third party libs .... annoying! |
Had the same problem after switching to use only "verbose" reporter! After adding "progress" to the reporters array in
With only "verbose" reporter, logs weren't displayed. |
Could not make it work either, as a REALLY hacky workaround for Chrome, you can monkeypatch the window console.log function from a second document. Useful ONLY when you are desperate, have complex tests and want to debug your tests with Chrome.
|
Looks like this issue reappears in v1.5.0. |
If its a help to anyone experiencing this, it appears that |
@stevemao @davidturissini Look at this issue maybe it's your case. Thanks |
I like the ideas in that issue :) But I think think should be a breaking change if |
As of
Modifying
See issues: #2582 & #2228 for more info. |
@sdtsui it works but it log all the messages twice, i still did not figure out how to make it once only. |
@sdtsui 's solution worked for me (once I put it in the right place) |
The solution provided by @sdtsui worked beautifully for me as well, thank you. Just throw the browserConsoleLogOptions into the karma.conf.js if you're having trouble on where to place it. |
Using solution near bottom here: karma-runner/karma-mocha#47
@sdtsui You're a hero among men. Thank you, sir. |
Im still unable to see console.log unless I have |
none of these work with karma 4.0 :-( |
Just going to add that some of the solutions posted here were actually breaking my karma config under the current version (4.0). Removing them as described here fixed it. |
I dont even have these...also my browser closes even using autowatch (brand new karma version)
|
I'm having this problem with Karma 4.0.1 and developing in NativeScript. |
I'm too |
Hi. I am using karma server to run my mocha unit tests for an angular app. The problem I am having is that messages that I write inside each
it
toconsole.log
don't show up in the terminal. They do show up, however, if I simply runmocha [unit_test_file_name].js
at command line. Am I missing something in the configuration? Here are my files:Thank you!
The text was updated successfully, but these errors were encountered: