question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

when starting karma with callback:

var karma = require('karma');
var opts = {
    configFile: __dirname + '/karma.conf.js',
    singleRun: true
};
new karma.Server(opts, () => null).start();

coverage causes the process to hang after running the tests.

using karma.conf.js:

module.exports = function(config) {
  config.set({
    files: ['test.js'],
    frameworks: ['jasmine'],
    reporters: ['coverage'],
    coverageReporter: {
        reporters: [{type: 'text'}]
    },
    port: 9876,
    browsers: ['PhantomJS'],
    plugins: [
        'karma-jasmine',
        'karma-phantomjs-launcher',
        'karma-coverage'
    ]
  })
}

The process exits normally if either: no callback is passed to the Server constructor, or the coverage reporter is disabled.

I notice there is no change in coverage that caused this issue; it may be related to socketio/socket.io#2368 ?

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:6
  • Comments:6

github_iconTop GitHub Comments

2reactions
bjacobelcommented, Apr 5, 2016

I have this same issue. For me, it seems to be related specifically to the text-summary reporter.

        coverageReporter: {
            dir: 'build', subdir: 'coverage-js',
            reporters: [
                {type: 'html', subdir: 'coverage-js/html'},
                {type: 'cobertura', file: 'coverage.xml'},
                {type: 'lcov', dir: 'coverage/'},
                {type: 'text-summary'}
            ]
        }
$> time npm test
> edx-ui-toolkit@0.9.1 test /Users/bjacobel/code/edx-ui-toolkit
> gulp test

[11:12:17] Using gulpfile ~/code/edx-ui-toolkit/gulpfile.js
[11:12:17] Starting 'test'...
< ... test output>
=============================== Coverage summary ===============================
Statements   : 92.81% ( 774/834 )
Branches     : 65.38% ( 119/182 )
Functions    : 95.51% ( 234/245 )
Lines        : 92.78% ( 771/831 )
================================================================================
[11:12:18] Finished 'test' after 1.89 s

real    0m34.425s
user    0m3.619s
sys 0m0.602s

But after removing the text-summary reporter:

        coverageReporter: {
            dir: 'build', subdir: 'coverage-js',
            reporters: [
                {type: 'html', subdir: 'coverage-js/html'},
                {type: 'cobertura', file: 'coverage.xml'},
                {type: 'lcov', dir: 'coverage/'}
            ]
        }
$> time npm test

> edx-ui-toolkit@0.9.1 test /Users/bjacobel/code/edx-ui-toolkit
> gulp test

[11:13:55] Using gulpfile ~/code/edx-ui-toolkit/gulpfile.js
[11:13:55] Starting 'test'...
< ... test output>
[11:13:56] Finished 'test' after 1.61 s

real    0m3.536s
user    0m3.271s
sys 0m0.451s

(Similar results when using the text reporter as a substitute for text-summary.)

Interestingly, it’s not taking that 30sec to produce the coverage output, as the 30sec hang is after the text-summary coverage is output.

1reaction
9stillcommented, Oct 19, 2016

At least in our case, this appears to have something to do with console output happening after text output is written to the console.

e.g.

...
---------------------------------------------|----------|----------|----------|----------|----------------|
All files                                    |    99.99 |    99.99 |    99.99 |    99.99 |                |
---------------------------------------------|----------|----------|----------|----------|----------------|
LOG: Error blah

will hang, but with

LOG: Error blah
...
---------------------------------------------|----------|----------|----------|----------|----------------|
All files                                    |    99.99 |    99.99 |    99.99 |    99.99 |                |
---------------------------------------------|----------|----------|----------|----------|----------------|

it will not…

For us it also seems to specifically hang within gulp, making me suspect that perhaps something is going haywire with the output stream…?

UPDATE & Workaround: waiting for 3 seconds after test suite completion to make sure any async calls that perform console.log execute before the coverage reporter runs successfully gets around the problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Karma freezes randomly when we try to run karma. #3389
Hi all, When i use the default install from: npm init @open-wc karma start randomly freezes, when i put on the debug log...
Read more >
Karma hangs at Karma starting - jasmine - Stack Overflow
My test is inside vendor/Jasmine/spec/PlayerSpec.js . Is this the correct way of using karma for testing or are there some more UI-frendly ways?...
Read more >
Karma Server Hangs on capturing browser : WEB-33839
Karma Connecting to Chrome Browser and running the tests. What happens instead? Hangs. Throws no errors. Was testing with Karma in Angular 6...
Read more >
Karma Gifts, Hanging Bud Vases, Set of 4,Neutral - Amazon.com
DETAILED: These hand painted bud vases are the perfect addition in any place. Hang them inside or on your back patio to add...
Read more >
Troubleshooting - Karma test runner
karma has an extensive set of tests and we have limited time to help with bugs. ... How Do I Debug a karma...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found