'karma start'在控制台上没有显示任何输出

时间:2016-04-04 02:18:23

标签: angularjs unit-testing testing karma-runner karma-jasmine

我是使用Jasmine进行Karma测试的初学者,我有一些问题要弄清楚为什么我的debug命令没有在控制台上显示我的AngularJs应用测试的任何输出。

同样,控制台是不显示任何输出的控制台,而不是浏览器。我已经看到了其他人认为浏览器假设显示某种输出的问题,我知道它不会那样工作。

它就像测试开始运行但它并没有真正停止。我猜我的karma.conf,可能是'basePath'或'files'。

这是我的karma.conf文件:

// Karma configuration
// Generated on Sun Apr 03 2016 15:29:19 GMT-0300 (Hora Padrão da Bahia)

module.exports = function(config) {
config.set({

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',


// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],


// list of files / patterns to load in the browser
files: [
    '../../tests/**/*.js',
    '../../src/**/*.js'
],


// list of files to exclude
exclude: [
],


// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},


// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],


// web server port
port: 9876,


// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,


// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],


// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,

// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
})
}

这就是我的控制台的样子

enter image description here

当我点击Karma在'karma start'上打开的浏览器实例中的'debug'按钮时。它保持这样,不会改变也不显示任何输出。

有人可以帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

Try adding this to your karma config loggers : [ { type: 'console' } ], Also check client.captureConsole Type: Boolean Default: true Description: Capture all console output and pipe it to the terminal.