15

I have a straightforward ember-cli app. I run the unit tests with ember test, which runs them in phantomJS. A test using Function.prototype.bind is failing, because of the well-known issue of phantom 1.9.x missing that API. I installed phantom 2.0, but now when I run ember test, after successfully building, the tests never run and it simply sits there hanging, no error, nothing.

Any ideas about what the issue could be here, or how to track it down?

OS is Windows.

  • Yo! Juzt uze polyfill for real: put https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind#Polyfill in vendor/phantom-polyfills.js and than import it in Brocfile: `if (app.env === 'test') { app.import('vendor/phantom-polyfills.js'); }` – lessless Feb 15 '15 at 12:22
  • @lessless Thanks, that's what I basically did to solve the problem, but I'd like to get things working with phantom 2.0. –  Feb 17 '15 at 18:11
  • Are you running your tests with `ember test` or `ember test --serve`? – Alex LaFroscia Feb 24 '15 at 06:29
  • 1
    I used to have this problem, but I tried phantomjs 2.0 again, and now it's working without any changes or problems. Perhaps upgrades to ember packages has solved it, as it was several versions ago that I was experiencing this problem. – Kevin Bullaughey Apr 28 '15 at 14:00

1 Answers1

1

I'm using Phantom JS 1.9.8 on OSX 10.10 but I've had the following problem and it may help you to know this.

In the application I'm using, the ENV.baseUrl flag is set to "/app-name" (the default being - '/') and I have that exact same behaviour. The test builds but does not go any further.

If I change my ENV.baseUrl to be '/', phantom runs the tests. Acceptance tests fail (I presume because of the different URL, but all unit tests pass). However, when I do this... running the tests in a real browser stops working (because it cannot find the resources - CSS,JS - anymore), I've tried changing the tests/index.html page to have a the correct reference to the scripts (/app-name/css/... etc...) and I got back the to running the tests in the browser, but phantom stopped working.

The same tests run fine in an "empty ember-cli project" where I copied my models, controllers and test to that project. Meaning that the difference between the two projects is basically environment configuration.

I've found these issues

Ember Issue 891 , Ember Issue 1003

Which seem to be related to the situation but both are closed for some time. I've been investigating this issue for almost a week now and can't seem to get tests running in the browser AND via ember test.

Pedro Rio
  • 1,444
  • 11
  • 16
  • 1
    i have the same issue where my baseUrl=/app-name. i followed the fix shown in the commit in this issue: https://github.com/ember-cli/ember-cli/issues/1003 which was to make sure i had ENV.baseURL = '/' set in environments.js for environment==='test'. I'm now able to run 'ember test' and tests in real browsers via 'ember test --serve' i am NOT able to run tests by hitting localhost:4200//tests anymore, but i can live with that since 'ember test --serve' works. – benzo Jul 08 '15 at 23:59
  • Sorry for the late reply @LeoHernandez, at the moment I have exact same situation as user benzo. Tests run with ember test and with ember test --serve but I cannot make then run when hitting localhost:4200/tests – Pedro Rio Jul 09 '15 at 13:28
  • It started working for me when I upgraded to PhantomJS 2.0 – leojh Jul 09 '15 at 13:29