【问题标题】:'karma start' does not show any output on the console'karma start' 不在控制台上显示任何输出
【发布时间】:2016-04-04 02:18:23
【问题描述】:

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

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

就像测试开始运行,但并没有真正停止。我猜我的 karma.conf 有问题,可能是“basePath”或“文件”。

这是我的 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
})
}

这就是我的控制台的样子

当我单击 Karma 在“karma start”上打开的浏览器实例中的“调试”按钮时。它保持这种状态,永远不会改变,也不会显示任何输出。

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

【问题讨论】:

  • 如果您使用 phantomJS 而不是 Chrome,您会在控制台中看到输出吗?

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


【解决方案1】:

尝试将此添加到您的业力配置中 loggers : [ { type: 'console' } ], 还要检查 client.captureConsole Type: Boolean Default: true Description: Capture all console output and pipe it to the terminal.

【讨论】:

    猜你喜欢
    • 2012-05-19
    • 2023-02-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-21
    • 1970-01-01
    • 2015-02-22
    • 1970-01-01
    相关资源
    最近更新 更多