diff --git a/lib/js/test/phantomjs-qunit.js b/lib/js/test/phantomjs-qunit.js
index a840db6..c1d7a5b 100755
--- a/lib/js/test/phantomjs-qunit.js
+++ b/lib/js/test/phantomjs-qunit.js
@@ -28,18 +28,18 @@
         start = new Date().getTime(),
         condition = false,
         interval = setInterval(function() {
-            if ( (new Date().getTime() - start < maxtimeOutMillis) && !condition ) {
+            if ((new Date().getTime() - start < maxtimeOutMillis) && !condition) {
                 // If not time-out yet and condition not yet fulfilled
-                condition = (typeof(testFx) === "string" ? eval(testFx) : testFx()); //< defensive code
+                condition = (typeof(testFx) === 'string' ? eval(testFx) : testFx()); //< defensive code
             } else {
-                if(!condition) {
+                if (!condition) {
                     // If condition still not fulfilled (timeout but condition is 'false')
                     console.log("'waitFor()' timeout");
                     phantom.exit(1);
                 } else {
                     // Condition fulfilled (timeout and/or condition is 'true')
-                    console.log("'waitFor()' finished in " + (new Date().getTime() - start) + "ms.");
-                    if (typeof(onReady) === "string") {
+                    console.log("'waitFor()' finished in " + (new Date().getTime() - start) + 'ms.');
+                    if (typeof(onReady) === 'string') {
                         eval(onReady);
                     } else {
                         onReady(); //< Do what it's supposed to do once the condition is fulfilled
@@ -63,21 +63,21 @@
     console.log(msg);
 };
 
-page.open(system.args[1], function(status){
-    if (status !== "success") {
-        console.log("Unable to access network");
+page.open(system.args[1], function(status) {
+    if (status !== 'success') {
+        console.log('Unable to access network');
         phantom.exit(1);
     } else {
-        waitFor(function(){
-            return page.evaluate(function(){
+        waitFor(function() {
+            return page.evaluate(function() {
                 var el = document.getElementById('qunit-testresult');
                 if (el && el.innerText.match('completed')) {
                     return true;
                 }
                 return false;
             });
-        }, function(){
-            var failedNum = page.evaluate(function(){
+        }, function() {
+            var failedNum = page.evaluate(function() {
                 var el = document.getElementById('qunit-testresult');
                 console.log(el.innerText);
                 try {
