Karma config proxy configuration gives 'failed to proxy' error

44 Views Asked by At

I have my project folder like so:

-src
-resources
   resource1.txt
   resource2.txt
   // and more
-unittests
   assets
       assetList1.txt
       assetList2.txt
       // and more
   karma.conf.js

And I have my karma.conf.js setup like so:

basePath: '../',
files: [
         { pattern: 'resources/**/*.txt', watched: false, included: false, served: true, nocache: false },
         { pattern: 'unittests/assets/*.txt', watched: false, included: false, served: true, nocache: false },
    ],

proxies: {
    "/resources/": "/base/resources/",
    "/unittests/assets/": "/base/unittests/assets/"
}

When I run karma, I am getting error like so before the tests begin running:

proxying request - /unittests/assets/assetList1.txt to localhost:9876
WARN [proxy]: failed to proxy /base/unittests/assets/assetList1.txt (connect ECONNREFUSED ::1:9876)

I have tried a lot of things suggested on various forums but no luck. Any suggestions what I might be missing in my understanding or setup or expectation?

0

There are 0 best solutions below