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

Disable or listen to the runner logs #2121

Closed
lifenautjoe opened this issue May 8, 2016 · 2 comments · Fixed by #3288 or karronoli/redpen#10 · May be fixed by Omrisnyk/npm-lockfiles#201
Closed

Disable or listen to the runner logs #2121

lifenautjoe opened this issue May 8, 2016 · 2 comments · Fixed by #3288 or karronoli/redpen#10 · May be fixed by Omrisnyk/npm-lockfiles#201

Comments

@lifenautjoe
Copy link

lifenautjoe commented May 8, 2016

Expected behavior

I want to be able to disable or listen to the runner logs.

Actual behavior

All runner logs are written in the standard output as seen here

Enviroment Details

  • Karma version: 3.8.6

Steps to reproduce the behaviour

  1. Create and start a server
var server = new Server({
    configFile : karmaConfigFile
}, function(exitCode) {
    console.log('Karma has exited with ' + exitCode);
    process.exit(exitCode)
});
server.start();
  1. On browsers_ready server event, trigger a run
server.on('browsers_ready',function () {
    runner.run({ configFile: karmaConfigFile});
});
  1. See the run output on the console twice, as both the server and the runner print the output
PhantomJS 2.1.1 (Linux 0.0.0): Executed 0 of 1 SUCCESS (0 secs / 0 secs)
PhantomJS 2.1.1 (Linux 0.0.0): Executed 1 of 1 SUCCESS (0.036 secs / 0.001 secs)

Possible solutions

Implement as event

Preferred

var run = runner.run({ configFile: karmaConfigFile});

run.on('data',function(data){
  console.log(data);
});

Implement flag

runner.run({ configFile: karmaConfigFile, logs: false});

Notes

This might reflect another issue.
My logLevel is set to config.LOG_DISABLE in my karma configuration file. The server seems to not respect the flag when manually triggering the run.

@developit
Copy link

This behavior makes it really hard to wrap Karma in an overarching CLI, which is something you'll be seeing more and more over the next year.

@JakeChampion
Copy link

Also seeing this behaviour, if someone can point to what needs changing, I will give it a go :-)

is-already-taken added a commit to is-already-taken/karma that referenced this issue Mar 18, 2019
This might be the case when Karma.run() is called inside the same
process/terminal as the server is running in (e.g. development
servers).

Fixes karma-runner#2121, karma-runner#2799
is-already-taken added a commit to is-already-taken/karma that referenced this issue Mar 18, 2019
This might be the case when Karma.run() is called inside the same
process/terminal as the server is running in (e.g. development
servers).

Fixes karma-runner#2121, karma-runner#2799
is-already-taken added a commit to is-already-taken/karma that referenced this issue Mar 18, 2019
This might be the case when Karma.run() is called inside the same
process/terminal as the server is running in (e.g. development
servers).

Fixes karma-runner#2121, karma-runner#2799
is-already-taken added a commit to is-already-taken/karma that referenced this issue Mar 30, 2019
This might be the case when Karma.run() is called inside the same
process/terminal as the server is running in (e.g. development
servers).

Fixes karma-runner#2121, karma-runner#2799
is-already-taken added a commit to is-already-taken/karma that referenced this issue Apr 10, 2019
Allow the consumer to decide whether to echo the runner progress or not.

This might be the case when Karma.run() is called inside the same
process/terminal as the server is running in (e.g. development
servers).

Fixes karma-runner#2121, karma-runner#2799
is-already-taken added a commit to is-already-taken/karma that referenced this issue Apr 10, 2019
is-already-taken added a commit to is-already-taken/karma that referenced this issue Apr 10, 2019
Allow the consumer to decide whether to echo the runner progress or not.

This might be the case when Karma.run() is called inside the same
process/terminal as the server is running in (e.g. development
servers).

Fixes karma-runner#2121, karma-runner#2799
is-already-taken added a commit to is-already-taken/karma that referenced this issue Apr 10, 2019
The CLI shall echo the progress, not the runner itself.

Fixes karma-runner#2121, karma-runner#2799
is-already-taken added a commit to is-already-taken/karma that referenced this issue Apr 11, 2019
The CLI shall echo the progress, not the runner itself.

Fixes karma-runner#2121, karma-runner#2799
johnjbarton pushed a commit that referenced this issue Jul 30, 2019
* feat(runner): Return emitter that forwards server data

Allow the consumer to decide whether to echo the runner progress or not.

This might be the case when Karma.run() is called inside the same
process/terminal as the server is running in (e.g. development
servers).

Fixes #2121, #2799

* feat(cli): Echo the runner progress event, don't echo in runner

The CLI shall echo the progress, not the runner itself.

Fixes #2121, #2799
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants