你如何成为SVG和夹具与噶亚军(又名Testacular) [英] How do you serve svg and fixtures with Karma Runner (aka Testacular)
问题描述
我一直试图在过去的两个小时呢!噶亚军以服务SVG文件和一个HTML夹具但至今没有运气。
I've been trying for the past two hours to get Karma runner to serve an svg file and an html fixture but so far no luck.
继此线程的第二个答案:<一href=\"http://stackoverflow.com/questions/13019215/error-while-integrating-html-with-testacularjs\">Error同时与testacularjs 我一直在尝试使用集成HTML 服
来表示我的固定装置和SVG文件应该由服务器分发,但我仍然得到'未找到的
Following the second answer on this thread: Error while integrating html with testacularjs I've been trying to use served
to indicate that my fixtures and svg file should be distributed by the server but I'm still getting 'NOT FOUND's
files = [
JASMINE,
JASMINE_ADAPTER,
REQUIRE,
REQUIRE_ADAPTER,
// put all components in requirejs 'paths' config here (included: false)
{ pattern: 'preview/public/components/**/*.js', included: false },
{ pattern: 'preview/public/js/**/*.js', included: false },
// assets
{ pattern: 'preview/public/img/svg/*.svg', included: false, served: true },
// helpers & fixtures for jasmine-jquery
{ pattern: 'test/libs/**/*.js', included: true },
{ pattern: 'test/fixtures/**/*.html', included: false, served: true },
// all src and test modules (included: false)
{ pattern: 'test/specs/**/*.spec.js', included: false },
// test main require module last
'test/test-main.js'
];
我在 jasmine.getFixtures()。fixturesPath
设置为 /灯具
,我可以看到它的使用正确的路径,但我还是结束了...
I'm setting the jasmine.getFixtures().fixturesPath
to /fixtures
and I can see that it's using the correct path but I still end up with...
GET HTTP://本地主机:9876 / IMG / SVG /定向垫-gradients.svg 404(未找到)
GET HTTP://本地主机:9876 /夹具/方向性pad.html 404(未找到)
如果任何人有装夹具和/或SVG与噶亚军的一个例子,我将真正的爱情去看一看。谢谢!
If anyone has an example of loading fixtures and/or svg with Karma runner I would really love to take a look. Thank you!
推荐答案
在这里回答我的问题...
Answering my own question here...
我是想在 HTTP加载我的装置://本地主机:9876 /夹具/方向性pad.html
相反,我应该试图在 HTTP访问它们://本地主机:9876 /基/测试/夹具/方向性pad.html
噶存储底座/
路径下的一切,所以你添加任何静态文件路径将需要启动这一点。
Karma stores everything under the base/
route, so any static file routes you add will need to start with that.
这篇关于你如何成为SVG和夹具与噶亚军(又名Testacular)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!