Angularjs karma运行角度测试可以在Chrome浏览器上运行,但不能在PhantomJs上运行

Angularjs karma运行角度测试可以在Chrome浏览器上运行,但不能在PhantomJs上运行,angularjs,jasmine,phantomjs,karma-runner,Angularjs,Jasmine,Phantomjs,Karma Runner,我在angular项目中运行单元测试,如果我使用Chrome运行,这会很好,但不是很多,我使用PhantomJS 我有一个karma.config.js文件,如下所示: module.exports = function (config) { config.set({ // base path that will be used to resolve all patterns (eg. files, exclude) basePath: '', // framewo

我在angular项目中运行单元测试,如果我使用Chrome运行,这会很好,但不是很多,我使用PhantomJS

我有一个karma.config.js文件,如下所示:

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: [
        'lib/*.js',
        'web/js/*.js',
        'test/spec/*spec.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', 'junit'],

    // the default configuration
    junitReporter: {
        outputFile: 'testResult/test-results.xml',
        suite: ''
    },



    // 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: false,


    // 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: true
});
};
像这样(使用Chrome)工作

但是,如果我将浏览器更改为PhantomJS,则会出现错误

Running "karma:unit" (karma) task
INFO [karma]: Karma v0.10.10 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 1.9.7 (Windows 7)]: Connected on socket Uy390TQWuDGR2pCi_GRy
PhantomJS 1.9.7 (Windows 7) ERROR
TypeError: '[object NodeList]' is not a valid argument for 
'Function.prototype.apply' (evaluating 'push.apply')
at C:/Users/Lino Simões/Documents/bitbucket/jenkins-test/lib/angular.js: 2594
PhantomJS 1.9.7 (Windows 7): Executed 0 of 0 ERROR (0.131 secs / 0 secs)
Warning: Task "karma:unit" failed. Used --force, continuing.

所以我的问题是,为什么这对
Chrome
有效,而对
PhantomJs
无效?我可以做些什么来让它对
PhantomJs
有效?
在PhantomJs 1.x中运行时,“[object NodeList]”不是一个有效的参数
问题,在angular.js
v1.3.0-beta.14
中已经修复,请参阅

尝试将angular.js升级到
v1.3.0-beta.14
或更高版本


另一个解决方案是使用PhantomJS 2

您使用的是angular.js的哪个版本?angular-1.3.0-beta.13它在beta.14中已修复,请尝试升级!请看我升级到中的最后一个版本,您应该发布您自己的答案(或者@runTarm-should),它在Angular的最新版本中得到了修复。如果有人好奇,还可以提供更多细节。如果需要帮助,请打开一个新问题(新错误:)
Running "karma:unit" (karma) task
INFO [karma]: Karma v0.10.10 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 1.9.7 (Windows 7)]: Connected on socket Uy390TQWuDGR2pCi_GRy
PhantomJS 1.9.7 (Windows 7) ERROR
TypeError: '[object NodeList]' is not a valid argument for 
'Function.prototype.apply' (evaluating 'push.apply')
at C:/Users/Lino Simões/Documents/bitbucket/jenkins-test/lib/angular.js: 2594
PhantomJS 1.9.7 (Windows 7): Executed 0 of 0 ERROR (0.131 secs / 0 secs)
Warning: Task "karma:unit" failed. Used --force, continuing.