微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

anglejs – 你如何用Karma Runner(又名Testacular)服务svg和fixture

过去两个小时,我一直在努力获得Karma的跑步者,以提供一个svg文件一个html设备,但到目前为止还没有运气.

在这个线程上的第二个答案之后:Error while integrating html with testacularjs我一直在尝试使用服务来表示我的灯具和svg文件应该由服务器分发,但我仍然得到’NOT FOUND’

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',// 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',// all src and test modules (included: false)
  { pattern: 'test/specs/**/*.spec.js',// test main require module last
  'test/test-main.js'
];

我正在设置jasmine.getFixtures().fixturesPath到/ fixtures,我可以看到它正在使用正确的路径,但我仍然最终…

GET http:// localhost:9876 / img / svg / directional-pad-gradients.svg 404(未找到)
GET http:// localhost:9876 / fixtures / directional-pad.html 404(未找到)

如果任何人有一个加载灯具和/或svg与Karma赛跑者的例子,我真的很想看看.谢谢!

在这里回答我自己的问题

我正在尝试加载我的装置:http:// localhost:9876 / fixtures / directional-pad.html

相反,我应该尝试访问http:// localhost:9876 / base / test / fixtures / directional-pad.html

Karma将所有内容都存储在基础/路由下,因此您添加的任何静态文件路由都需要从此开始.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐