Karma's base directory location

karma-jasmine, karma-runner, unit-testing

Solution

Found the answer:

By adding the following to the karma config file:

files: [ 
....
{ pattern: 'mocks/**/*.html', watched: true, served: true, included: false },
....

I managed to access the required file by browsing to

http://localhost:9876/base/mocks/file.html

Where th "`/base/`" prefix is required by default (if even changable).

Problem

Unable to load template fixtures for my tests while using karma. To simplify, Went to c:\ Created a 1.txt text file. Made a simple karma init file containing: ``` basePath: '', ``` Started karma using: ``` C:\> karma start .\sample.conf.js ``` Chrome opened up at: ``` http://localhost:9876/?id=49209467 ``` I then tried to navigate to: ``` http://localhost:9876/base/1.txt ``` but got a "NOT FOUND" error message in the browser, and a message from karma: ``` WARN [web-server]: 404: /base/1.txt ``` What am I missing here?

Original source