Prevent multiple calls to phantom.exit#183
Conversation
|
Thanks for this. I'd like to see someone replicate the issue and a green build before merging. It looks like the build has incidentally broken again so I'm testing it here: https://travis-ci.org/searls/jasmine-rails/builds/108023254 |
The test suite for rails 4.0 using jasmine 2 was failing. This suite tests that jasmine-rails was successfully mounted under /specs by asserting that the stats banner is shown. In the current version of jasmine 2, the class names that this banner is found under have changed to .jasmine-bar.jasmine-passed (presumeably from .bar.passed)
Currently, using jasmine-rails with phantomjs 2.1.1 causes phantomjs to segfault. It appears that the onInitialized handler registered in libe/assets/javascripts/jasmine-runner.js:48 is being executed multiple times. Each call registers a window.onLoad listener which eventually calls phantom.exit. It is unclear why page.onInitialized is called more than once. This commit introduces an initialized flag which prevents the page.onInitialized callback from registering more than one window.onLoad callback. Not an ideal fix. It would be better to figure out what causes page.onInitialized to be executed multiple times.
|
Fair enough. The failing specs on this branch (and also here: #181) are due to a change in the markup for the jasmine report page. The status banner classes changed to This branch contains a fix for that now. As for reproducting, two things:
Here's the full output from my mac And here's the full output from Travis |
|
This would be really good to get merged. We're using PhantomJS 2.1.1 for our Rails test stack, and it's a real pain having to downgrade to 1.9.8 for jasmine. Getting pressure from others on my team to use something other than Jasmine over it. |
|
Green is better than not green. LGTM. |
Prevent multiple calls to phantom.exit
|
Landed in 0.12.3 |
Currently, using jasmine-rails with phantomjs 2.1.1 causes phantomjs to
segfault. It appears that the onInitialized handler registered in
libe/assets/javascripts/jasmine-runner.js:48 is being executed multiple
times. Each call registers a window.onLoad listener which eventually
calls phantom.exit. It is unclear why page.onInitialized is called more
than once.
This commit introduces an initialized flag which prevents the
page.onInitialized callback from registering more than one window.onLoad
callback.
Not an ideal fix. It would be better to figure out what causes
page.onInitialized to be executed multiple times.