Skip to content
New issue

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

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

Already on GitHub? # to your account

console.* functions called outside tests are not output when singleRun is false #217

Open
tbhartman opened this issue Sep 24, 2018 · 1 comment

Comments

@tbhartman
Copy link

Note: this was reported in karma as karma-runner/karma#3131

Expected behaviour

Using client.captureConsole = true, I expect all console.* calls to output to the terminal.

d:\karma_captureConsole_bug> karma start
Chrome 68.0.3440 (Windows 10 0.0.0) INFO: 'I am outside of test!'

LOG: 'I am inside of test!'
Chrome 68.0.3440 (Windows 10 0.0.0): Executed 1 of 1 SUCCESS (0.007 secs / 0.001 secs)
TOTAL: 1 SUCCESS

Actual behaviour

Only console.* calls occurring while running a test are output to the terminal

d:\karma_captureConsole_bug> karma start
LOG: 'I am inside of test!'
Chrome 68.0.3440 (Windows 10 0.0.0): Executed 1 of 1 SUCCESS (0.007 secs / 0.001 secs)
TOTAL: 1 SUCCESS

Environment Details

  • Karma version (output of karma --version): 3.0.0
  • Karma-jasmine version:
C:\Users\\AppData\Roaming\npm
`-- karma-jasmine@1.1.2

karma.conf.js:

module.exports = (config) => {
  config.set({
    client: {captureConsole: true},
    frameworks: ['jasmine'],
    files: ['script.js'],
    browsers: ['Chrome'],
    singleRun: false,
  })
};

script.js:

console.info('I am outside of test!');
it('test1', function(){
  console.log('I am inside of test!');
});

Steps to reproduce the behaviour

  1. put above karma.conf.js, script.js in a directory
  2. run karma start to see actual behavior
  3. change karma.conf.js so that singleRun is true to observe expected behavior
@johnjbarton
Copy link
Contributor

Sorry, now I believe this is a karma-runner issue.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants