1

カルマ テストの実行に問題があります。「カルマスタート」すると「0件中0件を実行しました」と表示されますが、テストがあります。カルマはそれらを見ることができません。ただし、記述ブロック内にあるため、ファイルを実行します。これを引き起こす可能性のあるアイデアはありますか?これが私のカルマconfです。

// Testacular configuration

// base path, that will be used to resolve files and exclude
basePath = '';

frameworks = ['jasmine'];

// list of files / patterns to load in the browser
files = [
  JASMINE,
  JASMINE_ADAPTER,
  REQUIRE,
  REQUIRE_ADAPTER,

  // Add right away, lets include those
  'src/main/webapp/tools/js/vendor/shim/**/*.js',

  'src/main/webapp/tools/test/require-runner.js',

  // Test dependencies
  'src/main/webapp/tools/js/vendor/angular/angular-1.0.7.js',
  'src/main/webapp/tools/test/vendor/angular-*.js',

  // All app stuff that can be required!
  { pattern: 'src/main/webapp/tools/js/**/*', included : false },

  // All tests
  { pattern: 'src/main/webapp/tools/test/spec/**/*.test.js', included : false }

];


// list of files to exclude
exclude = [];

preprocessors = {
  'src/main/webapp/app/!(vendor)/**/*.js' : 'coverage'
};

// possible values: 'dots', 'progress', 'junit', 'teamcity'
// CLI --reporters progress
reporters = [ 'progress', 'junit' ];

coverageReporter = {
  type: 'cobertura',
  dir : 'coverage/'
};

// web server port
port = 1317;

// cli runner port
runnerPort = 1318;

// If browser does not capture in given timeout [ms], kill it
// CLI --capture-timeout 5000
captureTimeout = 5000;

// report which specs are slower than 500ms
// CLI --report-slower-than 500
reportSlowerThan = 500;

// enable / disable colors in the output (reporters and logs)
colors = true;

// level of logging
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
logLevel = LOG_INFO;

// enable / disable watching file and executing tests whenever any file changes
autoWatch = true;

// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari
// - PhantomJS
browsers = [ 'PhantomJS' ];

// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun = false;

これは私のrequire-runnerです

var allTestFiles = [],
    TEST_REGEXP  = /^.*spec\/.*test.js/,
    file;

// Build test files
for (file in window.__karma__.files) {
  if (window.__karma__.files.hasOwnProperty(file)) {
    if (TEST_REGEXP.test(file)) {
      allTestFiles.push(file);
    }
  }
}

require.config({
  // Testacular serves files under /base, which is the basePath from your config file
  baseUrl: '/base/src/main/webapp/tools',

  paths : {

    config      : 'config',

    // Angular specific libraries
    angular      : 'js/vendor/angular/angular-boilerplate',
    _ng          : 'js/vendor/angular/angular-1.0.7',
    _ngCookies   : 'js/vendor/angular/angular-cookies-1.0.7',

    // jQuery specific libraries
    jquery      : 'js/vendor/jquery'

  },

  // Shim. Things that do not support AMD
  shim : {
    _ng: {
      deps       : [ 'jquery' ],
      exports : 'angular'
    },
    _ngCookies   : [ '_ng' ]
  },

  // dynamically load all test files
  deps: allTestFiles,

  // we have to kick of jasmine, as it is asynchronous
  callback: window.__karma__.start
});
4

1 に答える 1