How to include PHP file to run test in Karma/Jasmi

2019-09-13 19:48发布

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条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-09-13 20:21

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

查看更多
登录 后发表回答