Closed naydenow closed 8 years ago
Sorry, I can not get your point. Do you mean running tests in phantom.js?
I want to run tests using the window object startup I get an error: ReferenceError: window is not defined
If you are targeting to test in browser environment, you should use browser side technology. For example, you may need to pack your test+target scripts with browerify or webpack, then try to execute tests in your browser. If the tests works well in your browser, then you can move tests into phantomjs.
Another way to do browser tests is by protractor, it also supports phantomjs.
If you are targeting to test in nodejs environment but you like to have DOM API, you may use jsdom to simulate browser environment inside nodejs. Refer to https://github.com/zordius/gulp-jsx-coverage/blob/master/test/test2.jsx#L20 you can see an example which try to test react.js component rendering without browser nor phantomjs.
Hi, how to connect Phantom js?