Skip to content

Commit

Permalink
Updated to be compatible with PhantomJS 1.6.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
pahen committed Jul 24, 2012
1 parent 755934c commit d3ee828
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
6 changes: 4 additions & 2 deletions QunitTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ public function main() {
if(!isset($this->file) and count($this->filesets) == 0) {
throw new BuildException("Missing either a nested fileset or attribute 'file' set");
}
exec($this->executable, $output);
if (!preg_match('/Usage:\sphantomjs/', implode('', $output))) throw new BuildException('phantomjs command not found');
exec($this->executable . ' --version', $output);
if (!preg_match('/\d+\.\d+\.\d+/', implode('', $output))) {
throw new BuildException('phantomjs command not found');
}

if($this->file instanceof PhingFile) {
$this->run($this->file->getPath());
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This project is a [Phing](https://github.com/phingofficial/phing) build tool tas

This project has been tested with

- [PhantomJS](https://github.com/ariya/phantomjs) 1.3.0
- [PhantomJS](https://github.com/ariya/phantomjs) 1.6.0
- [QUnit](https://github.com/jquery/qunit) 1.3

## Example
Expand Down
10 changes: 6 additions & 4 deletions run-qunit-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
* @param timeOutMillis the max amount of time to wait. If not specified, 3 sec is used.
*/
/*jshint evil:true */

var system = require('system'),
page = require('webpage').create();

function waitFor(testFx, onReady, timeOutMillis) {
var maxtimeOutMillis = timeOutMillis ? timeOutMillis : 30001, //< Default Max Timout is 3s
start = new Date().getTime(),
Expand Down Expand Up @@ -38,19 +42,17 @@ function waitFor(testFx, onReady, timeOutMillis) {
}, 100); //< repeat check every 250ms
}

if (phantom.args.length === 0 || phantom.args.length > 2) {
if (system.args.length === 1) {
console.log('Usage: run-qunit.js URL');
phantom.exit(1);
}

var page = new WebPage();

// Route "console.log()" calls from within the Page context to the main Phantom context (i.e. current "this")
page.onConsoleMessage = function (msg) {
console.log(msg);
};

page.open(phantom.args[0], function (status) {
page.open(system.args[1], function (status) {
if (status !== "success") {
console.log("Unable to access network");
phantom.exit(1);
Expand Down

0 comments on commit d3ee828

Please sign in to comment.