// Load EnvJs
load(arguments[0]);

// Allow script tags in test document to be eval'd
Envjs({
  scriptTypes: {
    '': true,
    'text/javascript': true
  }
});

// Load up the test document
window.location = arguments[1];

// Print the collected test results to stdout
(function(results) {
  var output;
  for (var i = 0, len = results.length; i < len; i++) {
    output = 'QUNITED_TEST_RESULT_START_TOKEN';
    output += JSON.stringify(results[i], null, 1);
    output += 'QUNITED_TEST_RESULT_END_TOKEN';
    java.lang.System.out.println(output);
  }
})(QUnited.collectedTestResults());

@@ -290,22 +290,35 @@
 %7B%0A  var 
-output
+tests, output, i, j
 ;%0A  for 
@@ -322,24 +322,18 @@
 or (
-var 
 i = 0
-, len =
+; i %3C
  res
@@ -350,23 +350,87 @@
 h; i
- %3C len; i
+++) %7B%0A    tests = results%5Bi%5D.tests;%0A    for (j = 0; j %3C tests.length; j
 ++) %7B%0A
+  
     
@@ -473,24 +473,26 @@
 TOKEN';%0A    
+  
 output += JS
@@ -493,14 +493,26 @@
  += 
-JSON.s
+QUnited.util.jsonS
 trin
@@ -520,30 +520,21 @@
 ify(
-r
+t
 es
-ul
 ts%5B
-i%5D, null, 1
+j%5D
 );%0A
+  
     
@@ -584,36 +584,21 @@
     
-java.lang.System.out.println
+  console.log
 (out
@@ -603,16 +603,22 @@
 utput);%0A
+    %7D%0A
   %7D%0A%7D)(Q

Refactor rhino runner js to return the correct json