Test's don't run with phantomjs and run in chrome with magic fail


#1

Guys, I’m really sick of this, so it would be great if anybody helped me.
I wrote unit and acceptance tests. I checked them only in chrome, and noticed, that my acceptance tests failed and after couple of days, thinking something was wrong with code, I realized that it wasn’t. As for the writing of tests I used doc and the book ember-cli-101. Everything’s pretty much simple, so I didn’t expect problems at all. But here’s my stackoverflow question http://stackoverflow.com/questions/32347521/ember-acceptance-tests-fail-when-running-all-at-once

I tried not to focus on that and finally to run tests using phantomjs and got another problem. My test-loader.js cannot be loaded because it can’t find property “define”. After hours of searching I tried a lot of approaches to solve this. For example, one advice was to use babel with option: “includePolyfill: true”.

Has anybody faced that?

P.S. Not sure, but I think, that there is a problem with dependencies in my package.json\bower.json, so if it would be helpful, I can provide them.


#2

The “can’t find property ‘[x]’” errors in Phantom can be caused by its lack of ES5 support for versions < 2.0.0. I can’t say for sure that’s what you’re experiencing, but if you have tests that pass (or at least run) in Chrome, and cannot even load in Phantom, you may have some pre-2.0.0-Phantom-incompatible ES5 code in your project.

For more info, check out http://stackoverflow.com/a/32437973/1067145. The easiest solution (if this is in fact the cause of the problems you’re seeing) is to install the Ember addon ember-cli-es5-shim. Hope that helps!


#3

The thing is, this problem that u described can happen if the version of phantomjs is 1.9.*, but I have 2.0.1. Anyway, I tried ur approach, no result. Also, I tried to upgrade versions of everything I have in bower.json or package.json. No result.


#4

Anything from this answer help? I remember feeling some of the same pain a while back (phantom 1/2 both)