grunt-lib-phantomjs icon indicating copy to clipboard operation
grunt-lib-phantomjs copied to clipboard

Use window.callPhantom?

Open jzaefferer opened this issue 12 years ago • 9 comments

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

jzaefferer avatar Dec 18 '12 12:12 jzaefferer

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

JamesMGreene avatar Dec 18 '12 12:12 JamesMGreene

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?

cowboy avatar Dec 18 '12 15:12 cowboy

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?

JamesMGreene avatar Dec 18 '12 16:12 JamesMGreene

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!

cowboy avatar Dec 18 '12 18:12 cowboy

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 avatar Jan 05 '13 16:01 maenu

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

jsoverson avatar Jan 07 '13 18:01 jsoverson

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

maenu avatar Jan 07 '13 19:01 maenu

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 ?

Arkni avatar Feb 12 '16 22:02 Arkni

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

jzaefferer avatar Feb 15 '16 12:02 jzaefferer