设置Karma配置

时间:2014-07-03 21:33:42

标签: phantomjs karma-runner

我的js/metrics/metrics.js文件取决于上面的data.tsv文件...我不确定如何正确加载tsv文件。抛出的错误是使用 PhantomJS 的tsv文件的解析错误。

frameworks: ['jasmine'],


// list of files / patterns to load in the browser
files: [


        'vendor/jquery.js',
        'vendor/jquery-ui.js',
        'vendor/d3.js',
        'vendor/d3.tip.js',
        'vendor/data.tsv',
        'js/metrics/metrics.js',
        'tests/testSpecMetrics.js'

],


// list of files to exclude
exclude: [

],

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

// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {


     'js/metrics/metrics.js':'coverage'
},

1 个答案:

答案 0 :(得分:0)

使用代理:

config = {

  // files, preprocessors, etc... here
  ...
  proxies:  {
    // change the value path accordingly with your path
    '/vendor/data.tsv' : 'http://localhost:9876/base/vendor/data.tsv'
  }

  // more config here...
  ...
}

来源:Karma documentation page(寻找代理人)。