Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Karma's base directory location

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?

like image 765
Lavi Avigdor Avatar asked Apr 09 '14 10:04

Lavi Avigdor


1 Answers

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).

like image 153
Lavi Avigdor Avatar answered Oct 20 '22 04:10

Lavi Avigdor