在过去的两个小时中,我一直在努力让Karma赛跑者提供svg文件和html固定文件,但到目前为止还没有运气。
在此线程的第二个答案之后:将html与testacularjs集成时出错,我一直试图served用来指示我的装置和svg文件应该由服务器分发,但是我仍然发现“找不到”
served
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,我可以看到它使用的是正确的路径,但最终还是…
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)
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跑步机来装载固定装置和/或svg的示例,我 真的 很想看看。谢谢!
在这里回答我自己的问题…
我正在尝试将装置装载到http://localhost:9876/fixtures/directional-pad.html
http://localhost:9876/fixtures/directional-pad.html
相反,我应该尝试在以下位置访问它们 http://localhost:9876/base/test/fixtures/directional- pad.html
http://localhost:9876/base/test/fixtures/directional- pad.html
业力将所有内容存储在该base/路由下,因此您添加的任何静态文件路由都需要以此作为开头。
base/