var fs = require('fs')
  , page = new WebPage()
  , file = fs.absolute('tests/test.html');

page.onConsoleMessage = function(msg) {
  console.log(msg);
  if (msg === "success")
    phantom.exit(0);
  else
    phantom.exit(1);
};

page.onError = function (msg, trace) {
  console.log(msg);
  trace.forEach(function(item) {
    console.log('  ', item.file, ':', item.line);
  });
  phantom.exit(1);
};

page.open('file://' + file, function (status) {
  if (status !== 'success') {
    console.log('Failed to load the address');
    return phantom.exit(1);
  }
});
@@ -24,18 +24,21 @@
   , page
+s
  =
+ %5B
  new Web
@@ -43,16 +43,33 @@
 ebPage()
+, new WebPage() %5D
 %0A  , fil
@@ -69,18 +69,21 @@
   , file
+s
  =
+ %5B
  fs.abso
@@ -105,19 +105,132 @@
 t.html')
-;%0A%0A
+, fs.absolute('tests/test2.html') %5D%0A  , i, page, file;%0A%0Afor (i in pages) %7B%0A  page = pages%5Bi%5D;%0A  file = files%5Bi%5D;%0A%0A  
 page.onC
@@ -257,24 +257,26 @@
 tion(msg) %7B%0A
+  
   console.lo
@@ -285,16 +285,18 @@
 msg);%0A  
+ 
+ 
 if (msg 
@@ -310,24 +310,26 @@
 ccess%22)%0A    
+  
 phantom.exit
@@ -333,16 +333,18 @@
 xit(0);%0A
+  
   else%0A 
@@ -342,24 +342,26 @@
    else%0A    
+  
 phantom.exit
@@ -361,28 +361,32 @@
 om.exit(1);%0A
+  
 %7D;%0A%0A
+  
 page.onError
@@ -412,16 +412,18 @@
 race) %7B%0A
+  
   consol
@@ -434,16 +434,18 @@
 g(msg);%0A
+  
   trace.
@@ -465,32 +465,34 @@
 ion(item) %7B%0A    
+ 
+ 
 console.log('  '
@@ -525,14 +525,18 @@
 e);%0A
+  
   %7D);%0A
+  
   ph
@@ -550,20 +550,24 @@
 xit(1);%0A
+  
 %7D;%0A%0A
+  
 page.ope
@@ -606,16 +606,18 @@
 atus) %7B%0A
+  
   if (st
@@ -634,32 +634,34 @@
 success') %7B%0A    
+  
 console.log('Fai
@@ -691,16 +691,18 @@
 ');%0A    
+  
 return p
@@ -723,9 +723,16 @@
 ;%0A  
-%7D%0A%7D);
+  %7D%0A  %7D);%0A%7D%0A

Update load_phantom.js to run the new tests on Travis CI