Suppress console logs from code being tested

Set client.captureConsole = false in your karma.conf.js config set function.

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

Original feature request.


The problem with the accepted answer is that it also suppress Karma logs.

If you only want to suppress the logging for the called methods set browserConsoleLogOptions.level to an appropriate level in your karma.conf.js. Setting browserConsoleLogOptions.level to "warn" will suppress all the log and debug logs.

copy-paste-ready snippet:

// file: karma.conf.js

module.exports = function (config) {
    config.set({
        // other options...
        browserConsoleLogOptions: {level: "warn"}
    }
}

See the karma configuration file documentation for references.