grunt-lib-phantomjs
grunt-lib-phantomjs copied to clipboard
Use window.callPhantom?
PhantomJS 1.6+ has a callback API that might be useful to replace the alert-json-tmp-file hackity hack. QUnit's phantomjs now makes use of that, maybe that's useful as a reference: https://github.com/jquery/qunit/blob/0552f0d8ae1a43fcfa0bbee17dc958fef2d29e0d/addons/phantomjs/runner.js#L115
Here's the API reference on it, too, freshly updated: https://github.com/ariya/phantomjs/wiki/API-Reference#wiki-webpage-onCallback
This seems like a good idea but I currently lack the bandwidth to do anything with it. If you submit a working PR, however, I'll definitely merge it in!
Also, unit tests?
Also, unit tests?
Do you mean you would want additional unit tests in the grunt-lib-phantomjs plugin for this, or you want to see the related PhantomJS unit tests?
I was just saying this project could probably use unit tests in general. But I don't know what they should look like. Maybe it's less unit and more functional. Either way, something that asserts that things are working as-intended!
I second that.
It took me hours to figure out how to communicate between PhantomJS and grunt, by alert()
or console.log()
, without changing the module that uses PhantomJS. But together with grunt-istanbul
and grunt-contrib-jasmine
, I have now a branch coverage report for my jasmine tests - awesome.
@maenu, I'd love to see how you set up coverage reporting with grunt-istanbul and contrib-jasmine
I made an example repo under example-grunt-jasmine-istanbul.
From PhantomJS
docs:
window.callPhantom
is still an experimental API. In the near future, it will be likely replaced with a message-based solution which will still provide the same functionality
Is this issue still relevant ?
Sounds useful to keep this open until that new API is available.