Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs osx上的karma/jasmine角度测试失败_Angularjs_Macos_Gruntjs_Jasmine_Karma Runner - Fatal编程技术网

Angularjs osx上的karma/jasmine角度测试失败

Angularjs osx上的karma/jasmine角度测试失败,angularjs,macos,gruntjs,jasmine,karma-runner,Angularjs,Macos,Gruntjs,Jasmine,Karma Runner,我有一个大的angular应用程序,它的测试从项目开始就通过grunt karma/karma jasmine运行良好。最近,大多数情况下测试都失败了,我不知道出了什么问题 我有一个git提交,每次都有效,下一个大部分时间失败,下一个两次失败。我已经摆弄它好几个小时了,却无法分离出任何能够使测试一致通过的东西。每次我认为我已经找到了让测试套件绊倒的东西,尝试使用这些知识时,几次提交最终都会出错 前25个测试总是通过ok,然后我得到一条错误消息,它不会给表带来太多内容: 错误:[$injector

我有一个大的angular应用程序,它的测试从项目开始就通过grunt karma/karma jasmine运行良好。最近,大多数情况下测试都失败了,我不知道出了什么问题

我有一个git提交,每次都有效,下一个大部分时间失败,下一个两次失败。我已经摆弄它好几个小时了,却无法分离出任何能够使测试一致通过的东西。每次我认为我已经找到了让测试套件绊倒的东西,尝试使用这些知识时,几次提交最终都会出错

前25个测试总是通过ok,然后我得到一条错误消息,它不会给表带来太多内容: 错误:[$injector:modulerr]未能实例化模块应用程序模块公用,原因是: 错误:[$injector:unpr]未知提供程序: http://errors.angularjs.org/1.2.26/$injector/unpr?p0= at/Users/hudson/workspace/app-recast-master/build/js/bottom/vendor/dev/20.js:3802 这条消息中奇怪的一点是,没有一个提供者被指定为未知的

这是在基于osx的盒子上发生的,它负责构建站点,但不是在我的windows机器上

下面是karma.conf的样子:

(function () {
  'use strict';

  var exportedConf = require('./build.js');
  var userConfig = exportedConf.userConfig;

  module.exports = function (config) {

    config.set({
      // Karma configuration

      // 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: [
        '../' + userConfig.build_dir + '/js/top/vendor/dev/**/*.js',
        //'../' + userConfig.build_dir + '/js/top/project-root/**/*.js',
        '../' + userConfig.src_dir + '/fragments/config.js',
        '../' + userConfig.build_dir + '/js/bottom/vendor/dev/**/*.js',
        '../' + userConfig.build_dir + '/js/bottom/project-root/**/*.js',
        '../test/mockFactory.js',
        '../test/jasmineVersionCheck.js',
        '../' + userConfig.project_dir + '/**/' + userConfig.tests_folderName + '/**/*.spec.js'
      ],

      // list of files to exclude
      exclude: [
      ],

      preprocessors: {
        // preprocessors are defined at the end of file so that we can use the userConfig variables in the key
      },

      // test results reporter to use
      reporters: ['progress', 'junit', 'coverage'],

      coverageReporter: {
        dir: '../' + userConfig.reports_dir + '/',
        reporters: [
          {
            type: 'cobertura',
            file: 'coverage.xml'
          },
          {
            type: 'html',
            file: 'coverage.html'
          }
        ]
      },


      // web server port
      port: process.env.KARMA_PORT || 8080,

      // cli runner port
      runnerPort: process.env.KARMA_RUNNER_PORT || 9100,


      junitReporter: {
        outputFile: '../' + userConfig.reports_dir + '/test-results.xml'
      },



      // enable / disable colors in the output (reporters and logs)
      colors: process.env.KARMA_COLORS || true,

      // level of logging
      // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
      logLevel: config.LOG_INFO,

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

      // Start these browsers, currently available:
      // - Chrome
      // - ChromeCanary
      // - Firefox
      // - Opera
      // - Safari (only Mac)
      // - PhantomJS
      // - IE (only Windows)
      browsers: [process.env.KARMA_BROWSER || 'PhantomJS'],

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

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

      plugins: ['karma-jasmine', 'karma-phantomjs-launcher', 'karma-junit-reporter', 'karma-coverage']


    });

    // polyfills need to be excluded or instanbul instrumentation goes wild and screws it all!
    config.preprocessors['../' + userConfig.build_dir + '/js/bottom/project-root/**/!(*-polyfills)+(.js)'] = ['coverage'];
  };
}());

我希望有人能在这件事上给我一个提示,我已经用尽了我能想到的所有选择。

也许,我真的说,也许,这可能是因为驼峰式的文件名。IOS不考虑文件名时的情况。


如果我有更好的想法,我会编辑我的答案。

谢谢,但这听起来不太可能是所有考虑因素的结果:/