【发布时间】:2013-04-10 23:57:13
【问题描述】:
过去两个小时我一直在尝试让 Karma runner 提供一个 svg 文件和一个 html 固定装置,但到目前为止还没有成功。
在此线程上的第二个答案之后:Error while integrating html with testacularjs 我一直在尝试使用served 来表示我的固定装置和 svg 文件应该由服务器分发,但我仍然得到“未找到”
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 设置为/fixtures,我可以看到它使用了正确的路径,但我最终还是...
GET http://localhost:9876/img/svg/directional-pad-gradients.svg 404 (Not Found)
GET http://localhost:9876/fixtures/directional-pad.html 404 (Not Found)
如果有人有使用 Karma runner 加载固定装置和/或 svg 的示例,我会真的看看。谢谢!
【问题讨论】: