raptoria7
raptoria7

Reputation: 969

Karma - how to serve up a file at URL?

I have code that creates a new window at '.newWave.html'. This content is served up using the HtmlWebpackPlugin

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

How do I do something similar with Karma, since I am testing the same code?

I am running karma at http://localhost:9876/

1.How can I edit my karma.conf such that karma will serve up newWave.html locally?

  1. How can I edit my karma.conf such that when I go to localhost:9876/newWave.html it points to another URL entirely, eg. localhost:8888/newWave.html?

I tried messing around with file and proxy and couldn't quite get it.

Upvotes: 1

Views: 1001

Answers (1)

raptoria7
raptoria7

Reputation: 969

figured it out.

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

Upvotes: 2

Related Questions