Karma proxies are not working

Abhijeet Pawar picture Abhijeet Pawar · Sep 7, 2015 · Viewed 7k times · Source

I am using Karma (v0.12.37) as test runner along with JSPM (v0.16.2). I have added following proxy config in karma so as to allow proper loading of JSPM files:

proxies: {
    '/base/jspm_packages/': '/base/app/jspm_packages/'
}

Bu this doesn't work out and fails on following:

PhantomJS 2.0.0 (Windows 8 0.0.0) ERROR: 'Potentially unhandled rejection [10] Error: XHR error loading http://localhost:9876/base/jspm_packages/npm/[email protected]
        Error loading http://localhost:9876/base/jspm_packages/npm/[email protected]
        Error loading http://localhost:9876/base/app/pages/examples/todo-example/todo.controller.test.js'

Debug Logs are giving:

proxying request - /base/jspm_packages/npm/[email protected] to localhost:9876
/base/app/jspm_packages/npm/[email protected] { host: 'localhost',
  port: 9876,
  baseProxyUrl: '/base/app/jspm_packages/',
  https: false }

But the following url containing 'app' in it works properly:

http ://localhost:9876/base/ app/ jspm_packages/npm/[email protected]

Any clue on what is going wrong?

Answer

topheman picture topheman · Sep 19, 2015

Try:

proxies: {
  '/app/': '/base/app/',
  '/jspm_packages/': '/base/jspm_packages/'
}