簡體   English   中英

因果報應/茉莉角測試在OSX上失敗

[英]karma/jasmine angular tests fails on osx

我有一個很大的角應用程序,自項目開始以來,grunt-karma / karma-jasmine的測試運行良好。 最近,測試在大多數時間開始失敗,我無法弄清楚出了什么問題。

我有一個git commit每次都可以工作,而下一次大多數時間都失敗,而下兩次則失敗。 我已經擺弄了好幾個小時,而無法隔離任何使測試始終通過的東西。 每次我認為我已經找到了絆倒測試套件的東西,嘗試使用這些知識時,一些提交后來最終都會出錯。

前25個測試始終通過ok,然后我收到一條錯誤消息,該錯誤消息對表影響不大: Error: [$injector:modulerr] Failed to instantiate module app-module-common due to: Error: [$injector:unpr] Unknown provider: http://errors.angularjs.org/1.2.26/$injector/unpr?p0= at /Users/hudson/workspace/app-recast-master/build/js/bottom/vendor/dev/20-angular.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'];
  };
}());

我希望有人能給我一個提示,我已經用盡了所有我能想到的選擇。

也許,我真的說,也許,這可能是由於駝峰文件名。 在文件名方面,IO不考慮這種情況。

如果我能有更好的想法,我會編輯我的答案。

暫無
暫無

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

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