21

I have had karma running using grunt on my application, but, for some reason, things stopped working. I updated karma with a re-install, which changed a lot, and changed my config file. All my files are being added and served, however it's not executing any of my tests.

For the time being (just to attempt to get things running again), I'm running outside of grunt, using the command karma start <pathtomyconfigfile>. Using the LOG_DEBUG option, I'm seeing everything Added and Served.

This is my config file:

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

    // base path, that will be used to resolve files and exclude
    basePath: '',


    // frameworks to use
    frameworks: ['jasmine'],


    // list of files / patterns to load in the browser
    files: [
        '../build/angular/angular.js',
        '../build/angular/angular-mocks.js',
        '../build/angular/angular-resource.js',
        '../build/angular/angular-cookies.js',
        '../build/angular/angular-scenario.js',
        '../src/**/*.js',
        '../dist/tmp/**/*.js',
        '../vendor/angular-bootstrap/*.js',
        '../vendor/angular-ui-utils/modules/route/*.js',
        '../vendor/angular-ui-utils/modules/mask/*.js'
    ],


    // list of files to exclude
    exclude: [

    ],


    // test results reporter to use
    // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
    reporters: ['progress'],


    // web server port
    port: 9018,


    // 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_DEBUG,


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


    // Start these browsers, currently available:
    // - Chrome
    // - ChromeCanary
    // - Firefox
    // - Opera
    // - Safari (only Mac)
    // - PhantomJS
    // - IE (only Windows)
    browsers: ['Chrome'],//nothing so we can start it on our own


    // If browser does not capture in given timeout [ms], kill it
    captureTimeout: 60000,


    // Continuous Integration mode
    // if true, it capture browsers, run tests and exit
    singleRun: false
});
};

I'm at a loss here, ran on different browsers, changing the files watched, switched between the old way to load frameworks within the file variable to the framework variable... Any help will be greatly appreciated. Thanks!

Additional information

It also seems that my karma is erroring out with no information other than error:

INFO [karma]: Karma v0.10.1 server started at http://localhost:9018/
INFO [launcher]: Starting browser Chrome
INFO [Chrome 28.0.1500 (Mac OS X 10.7.4)]: Connected on socket id sidUjYbbZINjGB_6wS6M
Chrome 28.0.1500 (Mac OS X 10.7.4): Executed 0 of 0 ERROR (0.777 secs / 0 secs)
4

2 回答 2

42

如果您使用的是角度场景,angular-scenario.js请从您的配置文件中删除,看看是否有帮助。

于 2013-08-21T20:45:21.557 回答
3

我自己在这个问题上花了几个小时。原来我使用的是 karma 0.10.3 并切换到 0.10.2 解决了这个问题。

试试看npm install karma@0.10.2是否能解决任何问题!

还要确保在您的配置autoWatch中设置为true

于 2013-10-26T02:25:44.553 回答