业力的基本目录位置 [英] Karma's base directory location

查看:88
本文介绍了业力的基本目录位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用业力时无法为我的测试加载模板夹具.为简化起见,

Unable to load template fixtures for my tests while using karma. To simplify,

去了c:\

创建了一个1.txt文本文件.

Created a 1.txt text file.

制作了一个简单的业力初始化文件,其中包含:

Made a simple karma init file containing:

basePath: '',

使用以下方法开始业力:

Started karma using:

C:\> karma start .\sample.conf.js

Chrome在以下位置打开:

Chrome opened up at:

http://localhost:9876/?id=49209467

然后我尝试导航到:

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

我在这里想念什么?

推荐答案

找到了答案:

通过将以下内容添加到业力配置文件中:

By adding the following to the karma config file:

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

我设法通过浏览

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

这篇关于业力的基本目录位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆