繁体   English   中英

业力测试。 在IT区块内看不到

[英]Karma testing. Cannot see inside IT block

我在运行业力测试时遇到问题。 当我“因果报应”时,它说“已成功执行0次,共0次成功”,但是我已经进行了测试。 业力只是看不见他们。 但是它运行文件,因为它位于describe块内部。 任何想法,这可能导致什么? 这是我的业力会议。

// 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;

这是我的要求

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
});

找到了解决我的问题的方法:“控制台中没有任何输出。但是我发现了错误。我添加了带有占位符的angular脚本,并且也加载了angular-scenario.js。删除后,此文件,我的测试已成功执行。”

我不小心将angular-scenario加载到其他文件中,从而导致了问题。 删除后,所有内容都像一个魅力。

可以在GitHub业力问题上找到主题

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM