Suppress console logs from test code

I am unit testing a function that contains a call console.log().

How can I prevent this call from being output to the output console of my test runner, in this case, Karma.
I use jasmine.

I am looking for a more elegant way than overriding consolebrowser methods , preferably configuration.

+5
source share
1 answer

Set client.captureConsole = falseto karma.conf.js the configuration settings function .

module.exports = function (config) {
    config.set({
        client: {
            captureConsole: false
        }
    });
};

Original feature request .

+8
source

All Articles