【问题标题】:Karma - how to serve up a file at URL?Karma - 如何在 URL 上提供文件?
【发布时间】:2017-06-16 06:25:48
【问题描述】:

我有在“.newWave.html”处创建新窗口的代码。此内容使用 HtmlWebpackPlugin 提供

new HtmlWebpackPlugin({
  template: './src/newWave.html',
  filename: 'newWave.html',
  inject: 'body',
  chunks: ['newWave'],
  hash: false
}),

由于我正在测试相同的代码,我如何使用 Karma 做类似的事情?

我在http://localhost:9876/运行业力

1.如何编辑我的 karma.conf 这样 karma 会在本地提供 newWave.html 吗?

  1. 如何编辑我的 karma.conf 以便当我转到 localhost:9876/newWave.html 时它完全指向另一个 URL,例如。 本地主机:8888/newWave.html?

我尝试弄乱文件和代理,但无法完全理解。

【问题讨论】:

    标签: karma-runner karma-mocha karma-coverage


    【解决方案1】:

    想通了。

    files: [
      './test/**/*.ts', 
      './test/**/*.tsx', 
      {pattern: './src/newWave.html', watched: false, served: true, included: true},
    ],
    proxies: {
      '/newWave.html': '/base/src/newWave.html'
    },
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-12-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多