gruntjs / grunt-lib-phantomjs

Grunt and PhantomJS, sitting in a tree.
http://gruntjs.com/
MIT License
93 stars 63 forks source link

Use window.callPhantom? #6

Open jzaefferer opened 11 years ago

jzaefferer commented 11 years ago

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

JamesMGreene commented 11 years ago

Here's the API reference on it, too, freshly updated: https://github.com/ariya/phantomjs/wiki/API-Reference#wiki-webpage-onCallback

cowboy commented 11 years ago

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?

JamesMGreene commented 11 years ago

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?

cowboy commented 11 years ago

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!

maenu commented 11 years ago

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.

jsoverson commented 11 years ago

@maenu, I'd love to see how you set up coverage reporting with grunt-istanbul and contrib-jasmine

maenu commented 11 years ago

I made an example repo under example-grunt-jasmine-istanbul.

Arkni commented 8 years ago

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 ?

jzaefferer commented 8 years ago

Sounds useful to keep this open until that new API is available.