How to include PHP file to run test in Karma/Jasmine?

蓝咒 提交于 2019-12-12 03:08:55

问题


The JS file I want to test is useless without PHP app on top of which it executes, because backend of my app generates all the DOM elements and data, which my JS app utilizes.

In other words, If I write in my.conf.js:

files: [
      'app.js',
      'spec/test.js'
      ],

app.js will throw tons of errors regarding not found elements, like tables, graph containers, etc.

Because of that I need to include my whole app to the test somehow. Perhaps by including my app's main index.php? Is it possible in Karma/Jasmine? Or do I rather set some kind of redirect?


回答1:


The comment by @xmike is valid, but if you were to insist you can use Karma's proxies configuration.



来源:https://stackoverflow.com/questions/40505024/how-to-include-php-file-to-run-test-in-karma-jasmine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!