簡體   English   中英

運行業力測試時出現角度錯誤

[英]Angular errors when running karma tests

我剛開始使用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的新手,所以這可能真的很愚蠢或顯而易見。

謝謝

要獲取有關引發的異常的更多信息,您需要在業力配置中使用其他瀏覽器,因為Chrome當前存在一個已知問題,它將無法顯示完整的錯誤消息。 這將幫助您了解設置的問題。 有關更多信息,請參見angular.js Issue 5568: https : //github.com/angular/angular.js/issues/5568

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM