运行业力测试时的角度误差

时间:2014-05-29 14:18:46

标签: javascript angularjs karma-runner

我刚刚开始使用Karma对我的JavaScript进行单元测试。这适用于使用Angular的应用程序,它现在给我带来了问题。

运行Karma Init来创建我的karma.conf.js文件后,我现在尝试使用

运行基本测试
Karma Start

当我运行此操作时,我会在控制台窗口中弹出Chrome但错误:

INFO [karma]: Karma v0.12.16 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
WARN [watcher]: Pattern "C:/ts-ang-app/public/test-app.js" does not match any file.
INFO [Chrome 35.0.1916 (Windows 8)]: Connected on socket 4A_Vzzao95ERUW0jS6jg with id 5966397
Chrome 35.0.1916 (Windows 8) ERROR
  Uncaught object
  at C:/ts-ang-app/public/vendor/angular/angular.js:1611

Chrome 35.0.1916 (Windows 8) ERROR
  Uncaught object
  at C:/ts-ang-app/public/vendor/angular/angular.js:1611

Chrome 35.0.1916 (Windows 8) ERROR
  Uncaught object
  at C:/ts-ang-app/public/vendor/angular/angular.js:1611

Chrome 35.0.1916 (Windows 8) ERROR
  Uncaught object
  at C:/ts-ang-app/public/vendor/angular/angular.js:1611

Chrome 35.0.1916 (Windows 8) ERROR
  Uncaught object
  at C:/ts-ang-app/public/vendor/angular/angular.js:1611

Chrome 35.0.1916 (Windows 8) ERROR
  Uncaught object
  at C:/ts-ang-app/public/vendor/angular/angular.js:1611

我的karma.conf.js文件如下:

// Karma configuration
// Generated on Thu May 29 2014 13:10:55 GMT+0100 (GMT Daylight Time)

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: ['mocha', 'chai', 'sinon-chai'],


        // list of files / patterns to load in the browser
        files: [
               'public/vendor/angular/angular.js',
               'public/vendor/angular-resource/angular-resource.js',
               'public/vendor/angular-mocks/angular-mocks.js',
               'public/test-app.js',

               'public/app/**/*.js',
               'test/tests/**/*.js'
        ],


        // list of files to exclude
        exclude: [
          'public/app/app.js'
        ],


        // 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
    });
};

我搜索过但找不到与此相关的任何内容。我想知道是什么原因造成的?

正如我所说,我是Karma的新手,所以它可能是一种非常愚蠢或明显的东西。

由于

1 个答案:

答案 0 :(得分:1)

要获取有关抛出异常的更多信息,您需要在karma配置中使用其他浏览器,因为Chrome目前存在一个已知问题,它不会显示完整的错误消息。这有助于您了解设置的问题。有关详细信息,请参阅angular.js问题5568:https://github.com/angular/angular.js/issues/5568