【问题标题】:Setting up Karma config设置 Karma 配置
【发布时间】:2014-07-04 18:32:54
【问题描述】:

我的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'
},

【问题讨论】:

  • 你搞定了吗?

标签: phantomjs karma-runner


【解决方案1】:

使用代理:

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(寻找代理)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多