Karma w / RequireJS获得404加载文件

时间:2015-06-04 20:40:39

标签: javascript requirejs karma-runner centos7

我正在使用具有工作业力设置的构建。

我试图将require.js用法集成到测试中。我主要按照Karma RequireJS doc页面中的说明转换我的" karma.conf.js"并构建" test-main.js"。

当我运行测试时,我看到类似的东西:

DEBUG [watcher]: Resolved files:
...
    /home/<myuid>/work/horizon/.venv/lib/python2.7/site-packages/xstatic/pkg/angular/data/angular.js
...
PhantomJS 1.9.8 (Linux) ERROR: 'There is no timestamp for .venv/lib/python2.7/site-packages/xstatic/pkg/angular/data/angular.js!'
...
WARN [web-server]: 404: /.venv/lib/python2.7/site-packages/xstatic/pkg/angular/data/angular.js
DEBUG [PhantomJS 1.9.8 (Linux)]: Disconnected during run, waiting 2000ms for reconnecting.
DEBUG [launcher]: Process PhantomJS exited with code 1
ERROR [launcher]: PhantomJS crashed.

我用:运行Karma:

node node_modules/karma/bin/karma start horizon/karma.conf.js --single-run

请注意,我运行此目录的目录是&#34; .venv&#34;文件夹和404中提到的文件确实存在于该位置。

这是我的&#34; horizo​​n / karma.conf.js&#34;文件:

module.exports = function(config){
  // Path to xstatic pkg path.
  var xstaticPath = '../../.venv/lib/python2.7/site-packages/xstatic/pkg/';
  config.set({
preprocessors: {
  // Used to collect templates for preprocessing.
  // NOTE: the templates must also be listed in the files section below.
  './**/*.html': ['ng-html2js'],
  // Used to indicate files requiring coverage reports.
  './**/!(*spec).js': ['coverage']
},
// Sets up module to process templates.
ngHtml2JsPreprocessor: {
  prependPrefix: '/static/',
  moduleName: 'templates'
},
// Assumes you're in the top-level horizon directory.
basePath : './static/',
// Contains both source and test files.
files : [
    {pattern: xstaticPath + '**/*.js', included: false},
    {pattern: '../../test-shim.js', included: false},
    {pattern: 'horizon/**/*.js', included: false},
    {pattern: 'dashboard-app/**/*.js', included: false},
    {pattern: 'framework/**/*.js', included: false},
    {pattern: '**/*.spec.js', included: false},
    '../test-main.js'
],
autoWatch : true,
frameworks: ['jasmine', 'requirejs'],
browsers : ['PhantomJS'],
phantomjsLauncher: {
  // Have phantomjs exit if a ResourceError is encountered
  // (useful if karma exits without killing phantom)
  exitOnResourceError: true
},
reporters : [ 'progress', 'coverage' ],
plugins : [
  'karma-phantomjs-launcher',
  'karma-firefox-launcher',
  'karma-jasmine',
  'karma-ng-html2js-preprocessor',
  'karma-coverage',
  'karma-requirejs'
],
logLevel: config.LOG_INFO,
coverageReporter: {
  type : 'html',
  dir : '../.coverage-karma/'
}
  });
};

ere is my&#34; horizo​​n / test-main.js&#34; (请注意,我试图内联变量引用值,但没有帮助):

var allTestFiles = [];
var TEST_REGEXP = /\.spec\.js$/;
Object.keys(window.__karma__.files).forEach(function(file) {
if (window.__karma__.files.hasOwnProperty(file)) {
    if (TEST_REGEXP.test(file)) {
    // Normalize paths to RequireJS module names.
    allTestFiles.push(file);
    }
  }
});
var xstaticPath = '../../.venv/lib/python2.7/site-packages/xstatic/pkg/';
require.config({
  baseUrl: '/base',
  paths: {
  'test-shim':         '../../test-shim',
  'jquery':            xstaticPath + 'jquery/data/jquery',
  //'angular':           xstaticPath + 'angular/data/angular',
  'angular':           '../../.venv/lib/python2.7/site-packages/xstatic/pkg/angular/data/angular',
  'angular-mocks':     xstaticPath + 'angular/data/angular-mocks',
  'angular-cookies':   xstaticPath + 'angular/data/angular-cookies',
  'angular-bootstrap': xstaticPath + 'angular_bootstrap/data/angular-bootstrap',
  'angular-sanitize':  xstaticPath + 'angular/data/angular-sanitize',
  'd3':                xstaticPath + 'd3/data/d3',
  'rickshaw':          xstaticPath + 'rickshaw/data/rickshaw',
  'smart-table':       xstaticPath + 'angular_smart_table/data/smart-table',
  'lrdragndrop':       xstaticPath + 'angular_lrdragndrop/data/lrdragndrop',
  'spin':              xstaticPath + 'spin/data/spin',
  'spin-jquery':       xstaticPath + 'spin/data/spin.jquery',
  'magic-search':      xstaticPath + 'magic_search/data/magic_search'
  },
  shim: {
'underscore': {
  exports: '_'
}
  },
  deps: allTestFiles,
  callback: window.__karma__.start
});

是否有明显错误,或者我可以采取哪些措施来获取更多信息?我在CentOS 7.0上运行它。

1 个答案:

答案 0 :(得分:0)

将您的cmake -DCMAKE_TOOLCHAIN_FILE=Arm_Toolchain .. CMake Error at /usr/share/cmake-3.0/Modules/FindBoost.cmake:1199 (message): Unable to find the requested Boost libraries. Boost version: 1.55.0 Boost include path: /usr/include Could not find the following static Boost libraries: boost_log_setup boost_log boost_date_time boost_filesystem boost_program_options boost_regex boost_system boost_thread boost_chrono 更改为:

karma.conf.js