Karma's base directory location

一个人想着一个人 提交于 2020-01-24 05:41:05

问题


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?


回答1:


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


来源:https://stackoverflow.com/questions/22959188/karmas-base-directory-location

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!