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.

Karma is reporting everything twice

See original GitHub issue

If I run my karma tests like this in node then the ‘dots’ reporter is outputting everything twice

var KarmaServer = require('karma').Server;
var karmaRunner = require('karma').runner;

var karmaConfig = {
    basePath: '',
    autoWatch: false,
    frameworks: ['jasmine'],
    reporters: ['dots'],
    files: [].concat(
        tasks['vendorJs'].getOutput(),
        'node_modules/angular-mocks/angular-mocks.js',
        'node_modules/ng-describe/dist/ng-describe.js',
        tasks['ts'].getOutput(),
        tasks['templates'].getOutput(),
        'Tests/Client/**/*.spec.js'
    ),
    browsers: ['PhantomJS']
};

var karmaServer = new KarmaServer(karmaConfig);
karmaServer.start();

karmaServer.on('browser_register', function (browser) {
    karmaRunner.run(karmaConfig);
})

This will output the following

05 02 2016 13:31:08.353:INFO [karma]: Karma v0.13.19 server started at http://localhost:9876/
05 02 2016 13:31:08.361:INFO [launcher]: Starting browser PhantomJS
05 02 2016 13:31:09.840:INFO [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Connected on socket /#1rTJlVKpIc8bFuWGAAAA with id 17442726
.....
PhantomJS 2.1.1 (Windows 8 0.0.0): Executed 5 of 5 SUCCESS (0.003 secs / 0.066 secs)
.....
PhantomJS 2.1.1 (Windows 8 0.0.0): Executed 5 of 5 SUCCESS (0.003 secs / 0.066 secs)

My tests aren’t actually being run twice but if I log something from a test it will show up twice in the output.

Any idea why this is happening?

Let me know if including my package.json or DEBUG output would be useful

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:21
  • Comments:25 (8 by maintainers)

github_iconTop GitHub Comments

8reactions
tcschillercommented, Aug 26, 2016

I had similar issues when trying to get a prettifier working - I’d get in my terminal both raw console output and the prettified output.

But, I was able to find a karma.conf setting that stopped the raw console output, returning only the prettified output.

karma.conf has a property called client, which is an object with several properties of its own. The one relevant here is captureConsole. This defaults to true, which means any console logging in the browser is sent back to your bash, too. Setting it to false solved my duplicate output issues. I wonder if making that change would help with this?

    client: {
        captureConsole: false
    }
2reactions
robianmcdcommented, Mar 14, 2016

I still see the issue when I run the tests with chrome.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chrome runs tests twice in karma - Stack Overflow
When using Chrome in my karma tests, I often (more than 50% of all runs) see that each test is executed twice by...
Read more >
How to Get a Duplicate Entry Removed From Your Credit Report
1. Obtain a copy of your credit report. You are entitled to one free credit report each year. This report includes information from...
Read more >
Consumer Reports: The truth about credit score apps
Credit score apps like Credit Karma, Experian Credit Report, and others promise instant access to credit scores, along with other features like ...
Read more >
Does Your Credit Score Change Daily? | Credit Karma
Your credit scores can change daily. You can get daily updates on your TransUnion and Equifax credit reports on Credit Karma.
Read more >
Karma Why Everything You Know About It Is Wrong
Karma Why Everything You Know About It Is Wrong on Amazon.com. ... Already read the book twice; will start reading the book again...
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