diff --git a/lib/js/src/thrift.js b/lib/js/src/thrift.js
index 3ea57c8..37ba690 100644
--- a/lib/js/src/thrift.js
+++ b/lib/js/src/thrift.js
@@ -20,21 +20,21 @@
 /*jshint evil:true*/
 
 /**
- * The Thrift namespace houses the Apache Thrift JavaScript library 
- * elements providing JavaScript bindings for the Apache Thrift RPC 
- * system. End users will typically only directly make use of the 
- * Transport (TXHRTransport/TWebSocketTransport) and Protocol 
+ * The Thrift namespace houses the Apache Thrift JavaScript library
+ * elements providing JavaScript bindings for the Apache Thrift RPC
+ * system. End users will typically only directly make use of the
+ * Transport (TXHRTransport/TWebSocketTransport) and Protocol
  * (TJSONPRotocol/TBinaryProtocol) constructors.
- * 
- * Object methods beginning with a __ (e.g. __onOpen()) are internal 
+ *
+ * Object methods beginning with a __ (e.g. __onOpen()) are internal
  * and should not be called outside of the object's own methods.
- * 
+ *
  * This library creates one global object: Thrift
  * Code in this library must never create additional global identifiers,
  * all features must be scoped within the Thrift namespace.
  * @namespace
  * @example
- *     var transport = new Thrift.Transport("http://localhost:8585");
+ *     var transport = new Thrift.Transport('http://localhost:8585');
  *     var protocol  = new Thrift.Protocol(transport);
  *     var client = new MyThriftSvcClient(protocol);
  *     var result = client.MyMethod();
@@ -55,7 +55,7 @@
      * @property {number}  VOID   - No value (only legal for return types).
      * @property {number}  BOOL   - True/False integer.
      * @property {number}  BYTE   - Signed 8 bit integer.
-     * @property {number}  I08    - Signed 8 bit integer.     
+     * @property {number}  I08    - Signed 8 bit integer.
      * @property {number}  DOUBLE - 64 bit IEEE 854 floating point.
      * @property {number}  I16    - Signed 16 bit integer.
      * @property {number}  I32    - Signed 32 bit integer.
@@ -70,23 +70,23 @@
      * @property {number}  UTF16  - Array of bytes representing a string of UTF16 encoded characters.
      */
     Type: {
-        'STOP' : 0,
-        'VOID' : 1,
-        'BOOL' : 2,
-        'BYTE' : 3,
-        'I08' : 3,
-        'DOUBLE' : 4,
-        'I16' : 6,
-        'I32' : 8,
-        'I64' : 10,
-        'STRING' : 11,
-        'UTF7' : 11,
-        'STRUCT' : 12,
-        'MAP' : 13,
-        'SET' : 14,
-        'LIST' : 15,
-        'UTF8' : 16,
-        'UTF16' : 17
+        STOP: 0,
+        VOID: 1,
+        BOOL: 2,
+        BYTE: 3,
+        I08: 3,
+        DOUBLE: 4,
+        I16: 6,
+        I32: 8,
+        I64: 10,
+        STRING: 11,
+        UTF7: 11,
+        STRUCT: 12,
+        MAP: 13,
+        SET: 14,
+        LIST: 15,
+        UTF8: 16,
+        UTF16: 17
     },
 
     /**
@@ -98,10 +98,10 @@
      * @property {number}  ONEWAY    - Oneway RPC call from client to server with no response.
      */
     MessageType: {
-        'CALL' : 1,
-        'REPLY' : 2,
-        'EXCEPTION' : 3,
-        'ONEWAY' : 4
+        CALL: 1,
+        REPLY: 2,
+        EXCEPTION: 3,
+        ONEWAY: 4
     },
 
     /**
@@ -130,7 +130,7 @@
       function F() {}
       F.prototype = superConstructor.prototype;
       constructor.prototype = new F();
-      constructor.prototype.name = name || "";
+      constructor.prototype.name = name || '';
     }
 };
 
@@ -171,17 +171,17 @@
  * @property {number}  UNSUPPORTED_CLIENT_TYPE - Unused.
  */
 Thrift.TApplicationExceptionType = {
-    'UNKNOWN' : 0,
-    'UNKNOWN_METHOD' : 1,
-    'INVALID_MESSAGE_TYPE' : 2,
-    'WRONG_METHOD_NAME' : 3,
-    'BAD_SEQUENCE_ID' : 4,
-    'MISSING_RESULT' : 5,
-    'INTERNAL_ERROR' : 6,
-    'PROTOCOL_ERROR' : 7,
-    'INVALID_TRANSFORM' : 8,
-    'INVALID_PROTOCOL' : 9,
-    'UNSUPPORTED_CLIENT_TYPE' : 10
+    UNKNOWN: 0,
+    UNKNOWN_METHOD: 1,
+    INVALID_MESSAGE_TYPE: 2,
+    WRONG_METHOD_NAME: 3,
+    BAD_SEQUENCE_ID: 4,
+    MISSING_RESULT: 5,
+    INTERNAL_ERROR: 6,
+    PROTOCOL_ERROR: 7,
+    INVALID_TRANSFORM: 8,
+    INVALID_PROTOCOL: 9,
+    UNSUPPORTED_CLIENT_TYPE: 10
 };
 
 /**
@@ -194,7 +194,7 @@
 */
 Thrift.TApplicationException = function(message, code) {
     this.message = message;
-    this.code = typeof code === "number" ? code : 0;
+    this.code = typeof code === 'number' ? code : 0;
 };
 Thrift.inherits(Thrift.TApplicationException, Thrift.TException, 'TApplicationException');
 
@@ -298,8 +298,8 @@
  * for backward compatibility.
  * @constructor
  * @param {string} [url] - The URL to connect to.
- * @classdesc The Apache Thrift Transport layer performs byte level I/O 
- * between RPC clients and servers. The JavaScript TXHRTransport object 
+ * @classdesc The Apache Thrift Transport layer performs byte level I/O
+ * between RPC clients and servers. The JavaScript TXHRTransport object
  * uses Http[s]/XHR. Target servers must implement the http[s] transport
  * (see: node.js example server_http.js).
  * @example
@@ -329,12 +329,12 @@
     },
 
     /**
-     * Sends the current XRH request if the transport was created with a URL 
+     * Sends the current XRH request if the transport was created with a URL
      * and the async parameter is false. If the transport was not created with
-     * a URL, or the async parameter is True and no callback is provided, or 
+     * a URL, or the async parameter is True and no callback is provided, or
      * the URL is an empty string, the current send buffer is returned.
      * @param {object} async - If true the current send buffer is returned.
-     * @param {object} callback - Optional async completion callback 
+     * @param {object} callback - Optional async completion callback
      * @returns {undefined|string} Nothing or the current send buffer.
      * @throws {string} If XHR fails.
      */
@@ -353,9 +353,9 @@
         if (callback) {
             //Ignore XHR callbacks until the data arrives, then call the
             //  client's callback
-            xreq.onreadystatechange = 
+            xreq.onreadystatechange =
               (function() {
-                var clientCallback = callback;    
+                var clientCallback = callback;
                 return function() {
                   if (this.readyState == 4 && this.status == 200) {
                     self.setRecvBuffer(this.responseText);
@@ -459,19 +459,19 @@
      * Returns true if the transport is open, XHR always returns true.
      * @readonly
      * @returns {boolean} Always True.
-     */    
+     */
     isOpen: function() {
         return true;
     },
 
     /**
      * Opens the transport connection, with XHR this is a nop.
-     */    
+     */
     open: function() {},
 
     /**
      * Closes the transport connection, with XHR this is a nop.
-     */    
+     */
     close: function() {},
 
     /**
@@ -511,7 +511,7 @@
     /**
      * Sets the send buffer to buf.
      * @param {string} buf - The buffer to send.
-     */    
+     */
     write: function(buf) {
         this.send_buf = buf;
     },
@@ -520,7 +520,7 @@
      * Returns the send buffer.
      * @readonly
      * @returns {string} The send buffer.
-     */ 
+     */
     getSendBuffer: function() {
         return this.send_buf;
     }
@@ -532,8 +532,8 @@
  * Constructor Function for the WebSocket transport.
  * @constructor
  * @param {string} [url] - The URL to connect to.
- * @classdesc The Apache Thrift Transport layer performs byte level I/O 
- * between RPC clients and servers. The JavaScript TWebSocketTransport object 
+ * @classdesc The Apache Thrift Transport layer performs byte level I/O
+ * between RPC clients and servers. The JavaScript TWebSocketTransport object
  * uses the WebSocket protocol. Target servers must implement WebSocket.
  * (see: node.js example server_http.js).
  * @example
@@ -556,20 +556,20 @@
     },
 
     /**
-     * Sends the current WS request and registers callback. The async 
-     * parameter is ignored (WS flush is always async) and the callback 
+     * Sends the current WS request and registers callback. The async
+     * parameter is ignored (WS flush is always async) and the callback
      * function parameter is required.
      * @param {object} async - Ignored.
      * @param {object} callback - The client completion callback.
-     * @returns {undefined|string} Nothing (undefined) 
+     * @returns {undefined|string} Nothing (undefined)
      */
     flush: function(async, callback) {
       var self = this;
       if (this.isOpen()) {
         //Send data and register a callback to invoke the client callback
-        this.socket.send(this.send_buf); 
+        this.socket.send(this.send_buf);
         this.callbacks.push((function() {
-          var clientCallback = callback;    
+          var clientCallback = callback;
           return function(msg) {
             self.setRecvBuffer(msg);
             clientCallback();
@@ -579,20 +579,20 @@
         //Queue the send to go out __onOpen
         this.send_pending.push({
           buf: this.send_buf,
-          cb:  callback
+          cb: callback
         });
       }
     },
 
-    __onOpen: function() { 
+    __onOpen: function() {
        var self = this;
        if (this.send_pending.length > 0) {
-          //If the user made calls before the connection was fully 
+          //If the user made calls before the connection was fully
           //open, send them now
           this.send_pending.forEach(function(elem) {
              this.socket.send(elem.buf);
              this.callbacks.push((function() {
-               var clientCallback = elem.cb;    
+               var clientCallback = elem.cb;
                return function(msg) {
                   self.setRecvBuffer(msg);
                   clientCallback();
@@ -602,19 +602,19 @@
           this.send_pending = [];
        }
     },
-    
-    __onClose: function(evt) { 
+
+    __onClose: function(evt) {
       this.__reset(this.url);
     },
-     
+
     __onMessage: function(evt) {
       if (this.callbacks.length) {
         this.callbacks.shift()(evt.data);
       }
     },
-     
-    __onError: function(evt) { 
-      console.log("Thrift WebSocket Error: " + evt.toString());
+
+    __onError: function(evt) {
+      console.log('Thrift WebSocket Error: ' + evt.toString());
       this.socket.close();
     },
 
@@ -632,15 +632,15 @@
     /**
      * Returns true if the transport is open
      * @readonly
-     * @returns {boolean} 
-     */    
+     * @returns {boolean}
+     */
     isOpen: function() {
         return this.socket && this.socket.readyState == this.socket.OPEN;
     },
 
     /**
      * Opens the transport connection
-     */    
+     */
     open: function() {
       //If OPEN/CONNECTING/CLOSING ignore additional opens
       if (this.socket && this.socket.readyState != this.socket.CLOSED) {
@@ -648,15 +648,15 @@
       }
       //If there is no socket or the socket is closed:
       this.socket = new WebSocket(this.url);
-      this.socket.onopen = this.__onOpen.bind(this); 
-      this.socket.onmessage = this.__onMessage.bind(this); 
-      this.socket.onerror = this.__onError.bind(this); 
-      this.socket.onclose = this.__onClose.bind(this); 
+      this.socket.onopen = this.__onOpen.bind(this);
+      this.socket.onmessage = this.__onMessage.bind(this);
+      this.socket.onerror = this.__onError.bind(this);
+      this.socket.onclose = this.__onClose.bind(this);
     },
 
     /**
      * Closes the transport connection
-     */    
+     */
     close: function() {
       this.socket.close();
     },
@@ -698,7 +698,7 @@
     /**
      * Sets the send buffer to buf.
      * @param {string} buf - The buffer to send.
-     */    
+     */
     write: function(buf) {
         this.send_buf = buf;
     },
@@ -707,7 +707,7 @@
      * Returns the send buffer.
      * @readonly
      * @returns {string} The send buffer.
-     */ 
+     */
     getSendBuffer: function() {
         return this.send_buf;
     }
@@ -718,8 +718,8 @@
  * Initializes a Thrift JSON protocol instance.
  * @constructor
  * @param {Thrift.Transport} transport - The transport to serialize to/from.
- * @classdesc Apache Thrift Protocols perform serialization which enables cross 
- * language RPC. The Protocol type is the JavaScript browser implementation 
+ * @classdesc Apache Thrift Protocols perform serialization which enables cross
+ * language RPC. The Protocol type is the JavaScript browser implementation
  * of the Apache Thrift TJSONProtocol.
  * @example
  *     var protocol  = new Thrift.Protocol(transport);
@@ -779,7 +779,7 @@
      * Returns the underlying transport.
      * @readonly
      * @returns {Thrift.Transport} The underlying transport.
-     */ 
+     */
     getTransport: function() {
         return this.transport;
     },
@@ -1021,7 +1021,7 @@
                 if (ch === '\"') {
                     escapedString += '\\\"'; // write out as: \"
                 } else if (ch === '\\') {    // a single backslash
-                    escapedString += '\\\\'; // write out as double backslash 
+                    escapedString += '\\\\'; // write out as double backslash
                 } else if (ch === '\b') {    // a single backspace: invisible
                     escapedString += '\\b';  // write out as: \b"
                 } else if (ch === '\f') {    // a single formfeed: invisible
@@ -1063,8 +1063,8 @@
        @property {Thrift.MessageType} mtype - The type of message call.
        @property {number} rseqid - The sequence number of the message (0 in Thrift RPC).
      */
-    /** 
-     * Deserializes the beginning of a message. 
+    /**
+     * Deserializes the beginning of a message.
      * @returns {AnonReadMessageBeginReturn}
      */
     readMessageBegin: function() {
@@ -1101,11 +1101,11 @@
     readMessageEnd: function() {
     },
 
-    /** 
-     * Deserializes the beginning of a struct. 
+    /**
+     * Deserializes the beginning of a struct.
      * @param {string} [name] - The name of the struct (ignored)
      * @returns {object} - An object with an empty string fname property
-     */    
+     */
     readStructBegin: function(name) {
         var r = {};
         r.fname = '';
@@ -1132,8 +1132,8 @@
        @property {Thrift.Type} ftype - The data type of the field.
        @property {number} fid - The unique identifier of the field.
      */
-    /** 
-     * Deserializes the beginning of a field. 
+    /**
+     * Deserializes the beginning of a field.
      * @returns {AnonReadFieldBeginReturn}
      */
     readFieldBegin: function() {
@@ -1201,8 +1201,8 @@
        @property {Thrift.Type} vtype - The data type of the value.
        @property {number} size - The number of elements in the map.
      */
-    /** 
-     * Deserializes the beginning of a map. 
+    /**
+     * Deserializes the beginning of a map.
      * @returns {AnonReadMapBeginReturn}
      */
     readMapBegin: function() {
@@ -1237,8 +1237,8 @@
        @property {Thrift.Type} etype - The data type of the element.
        @property {number} size - The number of elements in the collection.
      */
-    /** 
-     * Deserializes the beginning of a list. 
+    /**
+     * Deserializes the beginning of a list.
      * @returns {AnonReadColBeginReturn}
      */
     readListBegin: function() {
@@ -1259,8 +1259,8 @@
         this.readFieldEnd();
     },
 
-    /** 
-     * Deserializes the beginning of a set. 
+    /**
+     * Deserializes the beginning of a set.
      * @returns {AnonReadColBeginReturn}
      */
     readSetBegin: function(elemType, size) {
@@ -1272,8 +1272,8 @@
         return this.readListEnd();
     },
 
-    /** Returns an object with a value property set to 
-     *  False unless the next number in the protocol buffer 
+    /** Returns an object with a value property set to
+     *  False unless the next number in the protocol buffer
      *  is 1, in which case the value property is True */
     readBool: function() {
         var r = this.readI32();
@@ -1287,19 +1287,19 @@
         return r;
     },
 
-    /** Returns the an object with a value property set to the 
+    /** Returns the an object with a value property set to the
         next value found in the protocol buffer */
     readByte: function() {
         return this.readI32();
     },
 
-    /** Returns the an object with a value property set to the 
+    /** Returns the an object with a value property set to the
         next value found in the protocol buffer */
     readI16: function() {
         return this.readI32();
     },
 
-    /** Returns the an object with a value property set to the 
+    /** Returns the an object with a value property set to the
         next value found in the protocol buffer */
     readI32: function(f) {
         if (f === undefined) {
@@ -1333,26 +1333,26 @@
         return r;
     },
 
-    /** Returns the an object with a value property set to the 
+    /** Returns the an object with a value property set to the
         next value found in the protocol buffer */
     readI64: function() {
         return this.readI32();
     },
 
-    /** Returns the an object with a value property set to the 
+    /** Returns the an object with a value property set to the
         next value found in the protocol buffer */
     readDouble: function() {
         return this.readI32();
     },
 
-    /** Returns the an object with a value property set to the 
+    /** Returns the an object with a value property set to the
         next value found in the protocol buffer */
     readString: function() {
         var r = this.readI32();
         return r;
     },
 
-    /** Returns the an object with a value property set to the 
+    /** Returns the an object with a value property set to the
         next value found in the protocol buffer */
     readBinary: function() {
         var r = this.readI32();
@@ -1360,7 +1360,7 @@
         return r;
     },
 
-    /** 
+    /**
      * Method to arbitrarily skip over data */
     skip: function(type) {
         var ret, i;
@@ -1440,23 +1440,23 @@
  * Initializes a MutilplexProtocol Implementation as a Wrapper for Thrift.Protocol
  * @constructor
  */
-Thrift.MultiplexProtocol = function (srvName, trans, strictRead, strictWrite) {
+Thrift.MultiplexProtocol = function(srvName, trans, strictRead, strictWrite) {
     Thrift.Protocol.call(this, trans, strictRead, strictWrite);
     this.serviceName = srvName;
 };
 Thrift.inherits(Thrift.MultiplexProtocol, Thrift.Protocol, 'multiplexProtocol');
 
 /** Override writeMessageBegin method of prototype*/
-Thrift.MultiplexProtocol.prototype.writeMessageBegin = function (name, type, seqid) {
+Thrift.MultiplexProtocol.prototype.writeMessageBegin = function(name, type, seqid) {
 
     if (type === Thrift.MessageType.CALL || type === Thrift.MessageType.ONEWAY) {
-        Thrift.Protocol.prototype.writeMessageBegin.call(this, this.serviceName + ":" + name, type, seqid);
+        Thrift.Protocol.prototype.writeMessageBegin.call(this, this.serviceName + ':' + name, type, seqid);
     } else {
         Thrift.Protocol.prototype.writeMessageBegin.call(this, name, type, seqid);
     }
 };
 
-Thrift.Multiplexer = function () {
+Thrift.Multiplexer = function() {
     this.seqid = 0;
 };
 
@@ -1471,12 +1471,12 @@
  *    var protocol = new Thrift.Protocol(transport);
  *    var client = mp.createClient('AuthService', AuthServiceClient, transport);
 */
-Thrift.Multiplexer.prototype.createClient = function (serviceName, SCl, transport) {
+Thrift.Multiplexer.prototype.createClient = function(serviceName, SCl, transport) {
     if (SCl.Client) {
         SCl = SCl.Client;
     }
     var self = this;
-    SCl.prototype.new_seqid = function () {
+    SCl.prototype.new_seqid = function() {
         self.seqid += 1;
         return self.seqid;
     };
@@ -1519,7 +1519,7 @@
   return result;
 };
 
-copyMap = function(obj, types){
+copyMap = function(obj, types) {
 
   if (!obj) {return obj; }
 
@@ -1534,8 +1534,8 @@
   var Type = type;
 
   var result = {}, val;
-  for(var prop in obj) {
-    if(obj.hasOwnProperty(prop)) {
+  for (var prop in obj) {
+    if (obj.hasOwnProperty(prop)) {
       val = obj[prop];
       if (type === null) {
         result[prop] = val;
diff --git a/lib/js/test/deep-constructor.test.js b/lib/js/test/deep-constructor.test.js
index 9a19809..336fc15 100644
--- a/lib/js/test/deep-constructor.test.js
+++ b/lib/js/test/deep-constructor.test.js
@@ -1,16 +1,16 @@
 function serialize(data) {
-  var transport = new Thrift.Transport("/service");
-  var protocol  = new Thrift.Protocol(transport);
-  protocol.writeMessageBegin("", 0, 0);
+  var transport = new Thrift.Transport('/service');
+  var protocol = new Thrift.Protocol(transport);
+  protocol.writeMessageBegin('', 0, 0);
   data.write(protocol);
   protocol.writeMessageEnd();
   return transport.send_buf;
 }
 
 function deserialize(serialized, type) {
-  var transport = new Thrift.Transport("/service");
+  var transport = new Thrift.Transport('/service');
   transport.setRecvBuffer(serialized);
-  var protocol  = new Thrift.Protocol(transport);
+  var protocol = new Thrift.Protocol(transport);
   protocol.readMessageBegin();
   var data = new type();
   data.read(protocol);
@@ -27,12 +27,12 @@
 
     struct_list_field: [
       new Simple({value: 'b'}),
-      new Simple({value: 'c'}),
+      new Simple({value: 'c'})
     ],
 
     struct_set_field: [
       new Simple({value: 'd'}),
-      new Simple({value: 'e'}),
+      new Simple({value: 'e'})
     ],
 
     struct_map_field: {
@@ -75,12 +75,12 @@
 
     struct_list_field: [
       {value: 'b'},
-      {value: 'c'},
+      {value: 'c'}
     ],
 
     struct_set_field: [
       {value: 'd'},
-      {value: 'e'},
+      {value: 'e'}
     ],
 
     struct_map_field: {
@@ -129,7 +129,7 @@
 
 var cases = {
 
-  "Serialize/deserialize simple struct should return equal object": function(assert){
+  'Serialize/deserialize simple struct should return equal object': function(assert) {
     var tObj = new Simple({value: 'a'});
     var received = deserialize(serialize(tObj), Simple);
     assert.ok(tObj !== received);
@@ -137,21 +137,21 @@
   },
 
 
-  "Serialize/deserialize should return equal object": function(assert){
+  'Serialize/deserialize should return equal object': function(assert) {
     var tObj = createThriftObj();
     var received = deserialize(serialize(tObj), Complex);
     assert.ok(tObj !== received);
     assert.deepEqual(received, tObj);
   },
 
-  "Nested structs and containers initialized from plain js objects should serialize same as if initialized from thrift objects": function(assert) {
+  'Nested structs and containers initialized from plain js objects should serialize same as if initialized from thrift objects': function(assert) {
     var tObj1 = createThriftObj();
     var tObj2 = new Complex(createJsObj());
     assertValues(tObj2, assert);
     assert.equal(serialize(tObj2), serialize(tObj1));
   },
 
-  "Modifications to args object should not affect constructed Thrift object": function (assert) {
+  'Modifications to args object should not affect constructed Thrift object': function(assert) {
 
     var args = createJsObj();
     assertValues(args, assert);
@@ -174,7 +174,7 @@
     assertValues(tObj, assert);
   },
 
-  "nulls are ok": function(assert) {
+  'nulls are ok': function(assert) {
     var tObj = new Complex({
       struct_field: null,
       struct_list_field: null,
diff --git a/lib/js/test/phantom-client.js b/lib/js/test/phantom-client.js
index f75b256..d517e71 100644
--- a/lib/js/test/phantom-client.js
+++ b/lib/js/test/phantom-client.js
@@ -44,10 +44,10 @@
   var parseArgs = function(args) {
     var skips = [
       '--transport=http',
-      '--protocol=json',
+      '--protocol=json'
     ];
     var opts = {
-      port: '9090',
+      port: '9090'
       // protocol: 'json',
     };
     var keys = {};
@@ -90,8 +90,8 @@
     var opts = parseArgs(system.args.slice(1));
     var port = opts.port;
     var transport = new Thrift.Transport('http://localhost:' + port + '/service');
-    var protocol  = new Thrift.Protocol(transport);
-    var client    = new ThriftTest.ThriftTestClient(protocol);
+    var protocol = new Thrift.Protocol(transport);
+    var client = new ThriftTest.ThriftTestClient(protocol);
 
 
     // TODO: Remove duplicate code with test.js.
@@ -110,17 +110,17 @@
       }
     }
 
-    test("Void", function() {
+    test('Void', function() {
       equal(client.testVoid(), undefined);
     });
-    test("Binary (String)", function() {
+    test('Binary (String)', function() {
       var binary = '';
       for (var v = 255; v >= 0; --v) {
         binary += String.fromCharCode(v);
       }
       equal(client.testBinary(binary), binary);
     });
-    test("Binary (Uint8Array)", function() {
+    test('Binary (Uint8Array)', function() {
       var binary = '';
       for (var v = 255; v >= 0; --v) {
         binary += String.fromCharCode(v);
@@ -131,7 +131,7 @@
       }
       equal(client.testBinary(arr), binary);
     });
-    test("String", function() {
+    test('String', function() {
       equal(client.testString(''), '');
       equal(client.testString(stringTest), stringTest);
 
@@ -140,41 +140,41 @@
           ' backspace: \b formfeed: \f newline: \n return: \r tab: ' +
             ' now-all-of-them-together: "\\\/\b\n\r\t' +
               ' now-a-bunch-of-junk: !@#$%&()(&%$#{}{}<><><';
-              equal(client.testString(specialCharacters),specialCharacters);
+              equal(client.testString(specialCharacters), specialCharacters);
     });
-    test("Double", function() {
+    test('Double', function() {
       equal(client.testDouble(0), 0);
       equal(client.testDouble(-1), -1);
       equal(client.testDouble(3.14), 3.14);
-      equal(client.testDouble(Math.pow(2,60)), Math.pow(2,60));
+      equal(client.testDouble(Math.pow(2, 60)), Math.pow(2, 60));
     });
-    test("Bool", function() {
+    test('Bool', function() {
       equal(client.testBool(true), true);
       equal(client.testBool(false), false);
     });
-    test("I8", function() {
+    test('I8', function() {
       equal(client.testByte(0), 0);
       equal(client.testByte(0x01), 0x01);
     });
-    test("I32", function() {
+    test('I32', function() {
       equal(client.testI32(0), 0);
-      equal(client.testI32(Math.pow(2,30)), Math.pow(2,30));
-      equal(client.testI32(-Math.pow(2,30)), -Math.pow(2,30));
+      equal(client.testI32(Math.pow(2, 30)), Math.pow(2, 30));
+      equal(client.testI32(-Math.pow(2, 30)), -Math.pow(2, 30));
     });
-    test("I64", function() {
+    test('I64', function() {
       equal(client.testI64(0), 0);
       //This is usually 2^60 but JS cannot represent anything over 2^52 accurately
-      equal(client.testI64(Math.pow(2,52)), Math.pow(2,52));
-      equal(client.testI64(-Math.pow(2,52)), -Math.pow(2,52));
+      equal(client.testI64(Math.pow(2, 52)), Math.pow(2, 52));
+      equal(client.testI64(-Math.pow(2, 52)), -Math.pow(2, 52));
     });
 
-    test("Struct", function() {
+    test('Struct', function() {
       var structTestInput = new ThriftTest.Xtruct();
       structTestInput.string_thing = 'worked';
       structTestInput.byte_thing = 0x01;
-      structTestInput.i32_thing = Math.pow(2,30);
+      structTestInput.i32_thing = Math.pow(2, 30);
       //This is usually 2^60 but JS cannot represent anything over 2^52 accurately
-      structTestInput.i64_thing = Math.pow(2,52);
+      structTestInput.i64_thing = Math.pow(2, 52);
 
       var structTestOutput = client.testStruct(structTestInput);
 
@@ -186,18 +186,18 @@
       equal(JSON.stringify(structTestOutput), JSON.stringify(structTestInput));
     });
 
-    test("Nest", function() {
+    test('Nest', function() {
       var xtrTestInput = new ThriftTest.Xtruct();
       xtrTestInput.string_thing = 'worked';
       xtrTestInput.byte_thing = 0x01;
-      xtrTestInput.i32_thing = Math.pow(2,30);
+      xtrTestInput.i32_thing = Math.pow(2, 30);
       //This is usually 2^60 but JS cannot represent anything over 2^52 accurately
-      xtrTestInput.i64_thing = Math.pow(2,52);
+      xtrTestInput.i64_thing = Math.pow(2, 52);
 
       var nestTestInput = new ThriftTest.Xtruct2();
       nestTestInput.byte_thing = 0x02;
       nestTestInput.struct_thing = xtrTestInput;
-      nestTestInput.i32_thing = Math.pow(2,15);
+      nestTestInput.i32_thing = Math.pow(2, 15);
 
       var nestTestOutput = client.testNest(nestTestInput);
 
@@ -211,8 +211,8 @@
       equal(JSON.stringify(nestTestOutput), JSON.stringify(nestTestInput));
     });
 
-    test("Map", function() {
-      var mapTestInput = {7:77, 8:88, 9:99};
+    test('Map', function() {
+      var mapTestInput = {7: 77, 8: 88, 9: 99};
 
       var mapTestOutput = client.testMap(mapTestInput);
 
@@ -221,10 +221,10 @@
       }
     });
 
-    test("StringMap", function() {
+    test('StringMap', function() {
       var mapTestInput = {
-        "a":"123", "a b":"with spaces ", "same":"same", "0":"numeric key",
-        "longValue":stringTest, stringTest:"long key"
+        'a': '123', 'a b': 'with spaces ', 'same': 'same', '0': 'numeric key',
+        'longValue': stringTest, stringTest: 'long key'
       };
 
       var mapTestOutput = client.testStringMap(mapTestInput);
@@ -234,30 +234,30 @@
       }
     });
 
-    test("Set", function() {
-      var setTestInput = [1,2,3];
+    test('Set', function() {
+      var setTestInput = [1, 2, 3];
       ok(client.testSet(setTestInput), setTestInput);
     });
 
-    test("List", function() {
-      var listTestInput = [1,2,3];
+    test('List', function() {
+      var listTestInput = [1, 2, 3];
       ok(client.testList(listTestInput), listTestInput);
     });
 
-    test("Enum", function() {
+    test('Enum', function() {
       equal(client.testEnum(ThriftTest.Numberz.ONE), ThriftTest.Numberz.ONE);
     });
 
-    test("TypeDef", function() {
+    test('TypeDef', function() {
       equal(client.testTypedef(69), 69);
     });
 
-    test("Skip", function() {
+    test('Skip', function() {
       var structTestInput = new ThriftTest.Xtruct();
       var modifiedClient = new ThriftTest.ThriftTestClient(protocol);
 
       modifiedClient.recv_testStruct = function() {
-        var input  = modifiedClient.input;
+        var input = modifiedClient.input;
         var xtruct3 = new ThriftTest.Xtruct3();
 
         input.readMessageBegin();
@@ -278,9 +278,9 @@
       };
 
       structTestInput.string_thing = 'worked';
-      structTestInput.byte_thing   = 0x01;
-      structTestInput.i32_thing    = Math.pow(2,30);
-      structTestInput.i64_thing    = Math.pow(2,52);
+      structTestInput.byte_thing = 0x01;
+      structTestInput.i32_thing = Math.pow(2, 30);
+      structTestInput.i64_thing = Math.pow(2, 52);
 
       var structTestOutput = modifiedClient.testStruct(structTestInput);
 
@@ -291,10 +291,10 @@
       equal(structTestOutput.i64_thing, structTestInput.i64_thing);
     });
 
-    test("MapMap", function() {
+    test('MapMap', function() {
       var mapMapTestExpectedResult = {
-        "4":{"1":1,"2":2,"3":3,"4":4},
-        "-4":{"-4":-4, "-3":-3, "-2":-2, "-1":-1}
+        '4': {'1': 1, '2': 2, '3': 3, '4': 4},
+        '-4': {'-4': -4, '-3': -3, '-2': -2, '-1': -1}
       };
 
       var mapMapTestOutput = client.testMapMap(1);
@@ -309,55 +309,55 @@
       checkRecursively(mapMapTestOutput, mapMapTestExpectedResult);
     });
 
-    test("Xception", function() {
+    test('Xception', function() {
       try {
-        client.testException("Xception");
+        client.testException('Xception');
         ok(false);
       } catch (e) {
         equal(e.errorCode, 1001);
-        equal(e.message, "Xception");
+        equal(e.message, 'Xception');
       }
     });
 
-    test("no Exception", function() {
+    test('no Exception', function() {
       try {
-        client.testException("no Exception");
+        client.testException('no Exception');
       } catch (e) {
         ok(false);
       }
     });
 
-    test("TException", function() {
+    test('TException', function() {
       try {
-        client.testException("TException");
+        client.testException('TException');
         ok(false);
-      } catch(e) {
+      } catch (e) {
         ok(ok);
       }
     });
 
     var crazy = {
-      "userMap":{ "5":5, "8":8 },
-      "xtructs":[{
-        "string_thing":"Goodbye4",
-        "byte_thing":4,
-        "i32_thing":4,
-        "i64_thing":4
+      'userMap': { '5': 5, '8': 8 },
+      'xtructs': [{
+        'string_thing': 'Goodbye4',
+        'byte_thing': 4,
+        'i32_thing': 4,
+        'i64_thing': 4
       },
       {
-        "string_thing":"Hello2",
-        "byte_thing":2,
-        "i32_thing":2,
-        "i64_thing":2
+        'string_thing': 'Hello2',
+        'byte_thing': 2,
+        'i32_thing': 2,
+        'i64_thing': 2
       }]
     };
-    test("Insanity", function() {
+    test('Insanity', function() {
       var insanity = {
-        "1":{
-          "2":crazy,
-          "3":crazy
+        '1': {
+          '2': crazy,
+          '3': crazy
         },
-        "2":{ "6":{ "userMap":null, "xtructs":null } }
+        '2': { '6': { 'userMap': null, 'xtructs': null } }
       };
       var res = client.testInsanity(new ThriftTest.Insanity(crazy));
       ok(res, JSON.stringify(res));
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 {
diff --git a/lib/js/test/server_http.js b/lib/js/test/server_http.js
index e195e80..1115474 100644
--- a/lib/js/test/server_http.js
+++ b/lib/js/test/server_http.js
@@ -18,11 +18,11 @@
  */
 
 //This HTTP server is designed to serve the test.html browser
-//  based JavaScript test page (which must be in the current directory). 
+//  based JavaScript test page (which must be in the current directory).
 //  This server also supplies the Thrift based test service, which depends
 //  on the standard ThriftTest.thrift IDL service (which must be compiled
 //  for Node and browser based JavaScript in ./gen-nodejs and ./gen-js
-//  respectively). 
+//  respectively).
 
 var thrift = require('../../nodejs/lib/thrift');
 var ThriftTestSvc = require('./gen-nodejs/ThriftTest.js');
@@ -36,14 +36,14 @@
 };
 
 var ThriftWebServerOptions = {
-	files: ".",
+	files: '.',
 	services: {
-		"/service": ThriftTestSvcOpt
+		'/service': ThriftTestSvcOpt
 	}
 };
 
 var server = thrift.createWebServer(ThriftWebServerOptions);
 var port = 8088;
 server.listen(port);
-console.log("Serving files from: " + __dirname);
-console.log("Http/Thrift Server running on port: " + port);
+console.log('Serving files from: ' + __dirname);
+console.log('Http/Thrift Server running on port: ' + port);
diff --git a/lib/js/test/server_https.js b/lib/js/test/server_https.js
index af1745b..7e78d9e 100644
--- a/lib/js/test/server_https.js
+++ b/lib/js/test/server_https.js
@@ -18,7 +18,7 @@
  */
 
 //This HTTP server is designed to server the test.html browser
-//  based JavaScript test page (which must be in the current directory). 
+//  based JavaScript test page (which must be in the current directory).
 //  This server also supplies the Thrift based test service, which depends
 //  on the standard ThriftTest.thrift IDL service (which must be compiled
 //  for Node and browser based JavaScript in ./gen-nodejs and ./gen-js
@@ -26,7 +26,7 @@
 //  support libraries for test.html (jquery.js, qunit.js and qunit.css
 //  in ./build/js/lib).
 
-var fs = require("fs");
+var fs = require('fs');
 var thrift = require('../../nodejs/lib/thrift');
 var ThriftTestSvc = require('./gen-nodejs/ThriftTest.js');
 var ThriftTestHandler = require('./test_handler').ThriftTestHandler;
@@ -40,18 +40,18 @@
 };
 
 var ThriftWebServerOptions = {
-  files: ".",
+  files: '.',
   tls: {
-     key: fs.readFileSync("../../../test/keys/server.key"),
-     cert: fs.readFileSync("../../../test/keys/server.crt")
-  },	
+     key: fs.readFileSync('../../../test/keys/server.key'),
+     cert: fs.readFileSync('../../../test/keys/server.crt')
+  },
   services: {
-    "/service": ThriftTestSvcOpt
+    '/service': ThriftTestSvcOpt
   }
 };
 
 var server = thrift.createWebServer(ThriftWebServerOptions);
 var port = 8089;
 server.listen(port);
-console.log("Serving files from: " + __dirname);
-console.log("Http/Thrift Server running on port: " + port);
+console.log('Serving files from: ' + __dirname);
+console.log('Http/Thrift Server running on port: ' + port);
diff --git a/lib/js/test/test-async.js b/lib/js/test/test-async.js
index 336e2bc..b56f2a2 100644
--- a/lib/js/test/test-async.js
+++ b/lib/js/test/test-async.js
@@ -17,9 +17,9 @@
  * under the License.
  */
  /* jshint -W100 */
- 
+
 /*
- * Fully Async JavaScript test suite for ThriftTest.thrift. 
+ * Fully Async JavaScript test suite for ThriftTest.thrift.
  * These tests are designed to exercise the WebSocket transport
  * (which is exclusively async).
  *
@@ -31,7 +31,7 @@
 
 // all Languages in UTF-8
 var stringTest = "Afrikaans, Alemannisch, Aragonés, العربية, مصرى, Asturianu, Aymar aru, Azərbaycan, Башҡорт, Boarisch, Žemaitėška, Беларуская, Беларуская (тарашкевіца), Български, Bamanankan, বাংলা, Brezhoneg, Bosanski, Català, Mìng-dĕ̤ng-ngṳ̄, Нохчийн, Cebuano, ᏣᎳᎩ, Česky, Словѣ́ньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ, Чӑвашла, Cymraeg, Dansk, Zazaki, ދިވެހިބަސް, Ελληνικά, Emiliàn e rumagnòl, English, Esperanto, Español, Eesti, Euskara, فارسی, Suomi, Võro, Føroyskt, Français, Arpetan, Furlan, Frysk, Gaeilge, 贛語, Gàidhlig, Galego, Avañe'ẽ, ગુજરાતી, Gaelg, עברית, हिन्दी, Fiji Hindi, Hrvatski, Kreyòl ayisyen, Magyar, Հայերեն, Interlingua, Bahasa Indonesia, Ilokano, Ido, Íslenska, Italiano, 日本語, Lojban, Basa Jawa, ქართული, Kongo, Kalaallisut, ಕನ್ನಡ, 한국어, Къарачай-Малкъар, Ripoarisch, Kurdî, Коми, Kernewek, Кыргызча, Latina, Ladino, Lëtzebuergesch, Limburgs, Lingála, ລາວ, Lietuvių, Latviešu, Basa Banyumasan, Malagasy, Македонски, മലയാളം, मराठी, Bahasa Melayu, مازِرونی, Nnapulitano, Nedersaksisch, नेपाल भाषा, Nederlands, ‪Norsk (nynorsk)‬, ‪Norsk (bokmål)‬, Nouormand, Diné bizaad, Occitan, Иронау, Papiamentu, Deitsch, Norfuk / Pitkern, Polski, پنجابی, پښتو, Português, Runa Simi, Rumantsch, Romani, Română, Русский, Саха тыла, Sardu, Sicilianu, Scots, Sámegiella, Simple English, Slovenčina, Slovenščina, Српски / Srpski, Seeltersk, Svenska, Kiswahili, தமிழ், తెలుగు, Тоҷикӣ, ไทย, Türkmençe, Tagalog, Türkçe, Татарча/Tatarça, Українська, اردو, Tiếng Việt, Volapük, Walon, Winaray, 吴语, isiXhosa, ייִדיש, Yorùbá, Zeêuws, 中文, Bân-lâm-gú, 粵語";
-  
+
 function checkRecursively(map1, map2) {
   if (typeof map1 !== 'function' && typeof map2 !== 'function') {
     if (!map1 || typeof map1 !== 'object') {
@@ -44,25 +44,25 @@
   }
 }
 
-module("Base Types");
+module('Base Types');
 
-  asyncTest("Void", function() {
-    expect( 1 );
+  asyncTest('Void', function() {
+    expect(1);
     client.testVoid(function(result) {
       equal(result, undefined);
       QUnit.start();
     });
   });
-  
-  
-  asyncTest("String", function() {
-    expect( 3 );
+
+
+  asyncTest('String', function() {
+    expect(3);
     QUnit.stop(2);
-    client.testString('', function(result){
+    client.testString('', function(result) {
        equal(result, '');
        QUnit.start();
     });
-    client.testString(stringTest, function(result){
+    client.testString(stringTest, function(result) {
        equal(result, stringTest);
        QUnit.start();
     });
@@ -72,34 +72,34 @@
           ' backspace: \b formfeed: \f newline: \n return: \r tab: ' +
           ' now-all-of-them-together: "\\\/\b\n\r\t' +
           ' now-a-bunch-of-junk: !@#$%&()(&%$#{}{}<><><';
-    client.testString(specialCharacters, function(result){
+    client.testString(specialCharacters, function(result) {
        equal(result, specialCharacters);
        QUnit.start();
     });
   });
-  asyncTest("Double", function() {
-    expect( 4 );
+  asyncTest('Double', function() {
+    expect(4);
     QUnit.stop(3);
-    client.testDouble(0, function(result){
+    client.testDouble(0, function(result) {
        equal(result, 0);
        QUnit.start();
     });
-    client.testDouble(-1, function(result){
+    client.testDouble(-1, function(result) {
        equal(result, -1);
        QUnit.start();
     });
-    client.testDouble(3.14, function(result){
+    client.testDouble(3.14, function(result) {
        equal(result, 3.14);
        QUnit.start();
     });
-    client.testDouble(Math.pow(2,60), function(result){
-       equal(result, Math.pow(2,60));
+    client.testDouble(Math.pow(2, 60), function(result) {
+       equal(result, Math.pow(2, 60));
        QUnit.start();
     });
   });
-  // TODO: add testBinary() 
-  asyncTest("Byte", function() {
-    expect( 2 );
+  // TODO: add testBinary()
+  asyncTest('Byte', function() {
+    expect(2);
     QUnit.stop();
     client.testByte(0, function(result) {
        equal(result, 0);
@@ -110,110 +110,95 @@
        QUnit.start();
     });
   });
-  asyncTest("I32", function() {
-    expect( 3 );
+  asyncTest('I32', function() {
+    expect(3);
     QUnit.stop(2);
-    client.testI32(0, function(result){
+    client.testI32(0, function(result) {
        equal(result, 0);
        QUnit.start();
     });
-    client.testI32(Math.pow(2,30), function(result){
-       equal(result, Math.pow(2,30));
+    client.testI32(Math.pow(2, 30), function(result) {
+       equal(result, Math.pow(2, 30));
        QUnit.start();
     });
-    client.testI32(-Math.pow(2,30), function(result){
-       equal(result, -Math.pow(2,30));
+    client.testI32(-Math.pow(2, 30), function(result) {
+       equal(result, -Math.pow(2, 30));
        QUnit.start();
     });
   });
-  asyncTest("I64", function() {
-    expect( 3 );
+  asyncTest('I64', function() {
+    expect(3);
     QUnit.stop(2);
-    client.testI64(0, function(result){
+    client.testI64(0, function(result) {
        equal(result, 0);
        QUnit.start();
     });
     //This is usually 2^60 but JS cannot represent anything over 2^52 accurately
-    client.testI64(Math.pow(2,52), function(result){
-       equal(result, Math.pow(2,52));
+    client.testI64(Math.pow(2, 52), function(result) {
+       equal(result, Math.pow(2, 52));
        QUnit.start();
     });
-    client.testI64(-Math.pow(2,52), function(result){
-       equal(result, -Math.pow(2,52));
+    client.testI64(-Math.pow(2, 52), function(result) {
+       equal(result, -Math.pow(2, 52));
        QUnit.start();
     });
   });
-  
 
-  
 
-module("Structured Types");
 
-  asyncTest("Struct", function() {
-    expect( 5 );
+
+module('Structured Types');
+
+  asyncTest('Struct', function() {
+    expect(5);
     var structTestInput = new ThriftTest.Xtruct();
     structTestInput.string_thing = 'worked';
     structTestInput.byte_thing = 0x01;
-    structTestInput.i32_thing = Math.pow(2,30);
+    structTestInput.i32_thing = Math.pow(2, 30);
     //This is usually 2^60 but JS cannot represent anything over 2^52 accurately
-    structTestInput.i64_thing = Math.pow(2,52);
+    structTestInput.i64_thing = Math.pow(2, 52);
 
-    client.testStruct(structTestInput, function(result){
+    client.testStruct(structTestInput, function(result) {
       equal(result.string_thing, structTestInput.string_thing);
       equal(result.byte_thing, structTestInput.byte_thing);
       equal(result.i32_thing, structTestInput.i32_thing);
       equal(result.i64_thing, structTestInput.i64_thing);
       equal(JSON.stringify(result), JSON.stringify(structTestInput));
-      QUnit.start();      
+      QUnit.start();
     });
   });
 
-  asyncTest("Nest", function() {
-    expect( 7 );
+  asyncTest('Nest', function() {
+    expect(7);
     var xtrTestInput = new ThriftTest.Xtruct();
     xtrTestInput.string_thing = 'worked';
     xtrTestInput.byte_thing = 0x01;
-    xtrTestInput.i32_thing = Math.pow(2,30);
+    xtrTestInput.i32_thing = Math.pow(2, 30);
     //This is usually 2^60 but JS cannot represent anything over 2^52 accurately
-    xtrTestInput.i64_thing = Math.pow(2,52);
-    
+    xtrTestInput.i64_thing = Math.pow(2, 52);
+
     var nestTestInput = new ThriftTest.Xtruct2();
     nestTestInput.byte_thing = 0x02;
     nestTestInput.struct_thing = xtrTestInput;
-    nestTestInput.i32_thing = Math.pow(2,15);
-    
-    client.testNest(nestTestInput, function(result){
+    nestTestInput.i32_thing = Math.pow(2, 15);
+
+    client.testNest(nestTestInput, function(result) {
       equal(result.byte_thing, nestTestInput.byte_thing);
       equal(result.struct_thing.string_thing, nestTestInput.struct_thing.string_thing);
       equal(result.struct_thing.byte_thing, nestTestInput.struct_thing.byte_thing);
       equal(result.struct_thing.i32_thing, nestTestInput.struct_thing.i32_thing);
       equal(result.struct_thing.i64_thing, nestTestInput.struct_thing.i64_thing);
-      equal(result.i32_thing, nestTestInput.i32_thing);  
+      equal(result.i32_thing, nestTestInput.i32_thing);
       equal(JSON.stringify(result), JSON.stringify(nestTestInput));
-      QUnit.start();      
+      QUnit.start();
     });
   });
 
-  asyncTest("Map", function() {
-    expect( 3 );
-    var mapTestInput = {7:77, 8:88, 9:99};
+  asyncTest('Map', function() {
+    expect(3);
+    var mapTestInput = {7: 77, 8: 88, 9: 99};
 
-    client.testMap(mapTestInput, function(result){
-      for (var key in result) {
-        equal(result[key], mapTestInput[key]);
-      }
-      QUnit.start();  
-    });
-  });
-
-  asyncTest("StringMap", function() {
-    expect( 6 );
-    var mapTestInput = {
-      "a":"123", "a b":"with spaces ", "same":"same", "0":"numeric key",
-      "longValue":stringTest, stringTest:"long key"
-    };
-
-    client.testStringMap(mapTestInput, function(result){
+    client.testMap(mapTestInput, function(result) {
       for (var key in result) {
         equal(result[key], mapTestInput[key]);
       }
@@ -221,51 +206,66 @@
     });
   });
 
-  asyncTest("Set", function() {
-    expect( 1 );
-    var setTestInput = [1,2,3];
-    client.testSet(setTestInput, function(result){
+  asyncTest('StringMap', function() {
+    expect(6);
+    var mapTestInput = {
+      'a': '123', 'a b': 'with spaces ', 'same': 'same', '0': 'numeric key',
+      'longValue': stringTest, stringTest: 'long key'
+    };
+
+    client.testStringMap(mapTestInput, function(result) {
+      for (var key in result) {
+        equal(result[key], mapTestInput[key]);
+      }
+      QUnit.start();
+    });
+  });
+
+  asyncTest('Set', function() {
+    expect(1);
+    var setTestInput = [1, 2, 3];
+    client.testSet(setTestInput, function(result) {
       ok(result, setTestInput);
       QUnit.start();
     });
   });
 
-  asyncTest("List", function() {
-    expect( 1 );
-    var listTestInput = [1,2,3];
-    client.testList(listTestInput, function(result){
+  asyncTest('List', function() {
+    expect(1);
+    var listTestInput = [1, 2, 3];
+    client.testList(listTestInput, function(result) {
       ok(result, listTestInput);
       QUnit.start();
     });
   });
 
-  asyncTest("Enum", function() {
-    expect( 1 );
-    client.testEnum(ThriftTest.Numberz.ONE, function(result){
+  asyncTest('Enum', function() {
+    expect(1);
+    client.testEnum(ThriftTest.Numberz.ONE, function(result) {
       equal(result, ThriftTest.Numberz.ONE);
       QUnit.start();
     });
   });
 
-  asyncTest("TypeDef", function() {
-    expect( 1 );
-    client.testTypedef(69, function(result){
+  asyncTest('TypeDef', function() {
+    expect(1);
+    client.testTypedef(69, function(result) {
       equal(result, 69);
       QUnit.start();
     });
   });
 
 
-module("deeper!");
+module('deeper!');
 
-  asyncTest("MapMap", function() {
-    expect( 16 );
+  asyncTest('MapMap', function() {
+    expect(16);
     var mapMapTestExpectedResult = {
-      "4":{"1":1,"2":2,"3":3,"4":4},
-      "-4":{"-4":-4, "-3":-3, "-2":-2, "-1":-1}
+      '4': {'1': 1, '2': 2, '3': 3, '4': 4},
+      '-4': {'-4': -4, '-3': -3, '-2': -2, '-1': -1}
     };
 
-    client.testMapMap(1, function(result){
+    client.testMapMap(1, function(result) {
       for (var key in result) {
         for (var key2 in result[key]) {
           equal(result[key][key2], mapMapTestExpectedResult[key][key2]);
@@ -277,67 +277,67 @@
   });
 
 
-module("Exception");
+module('Exception');
 
-  asyncTest("Xception", function() {
+  asyncTest('Xception', function() {
     expect(2);
-    client.testException("Xception", function(e){
+    client.testException('Xception', function(e) {
       equal(e.errorCode, 1001);
-      equal(e.message, "Xception");
+      equal(e.message, 'Xception');
       QUnit.start();
     });
   });
 
-  asyncTest("no Exception", 0, function() {
-    expect( 1 );
-    client.testException("no Exception", function(e){
+  asyncTest('no Exception', 0, function() {
+    expect(1);
+    client.testException('no Exception', function(e) {
       ok(!e);
       QUnit.start();
     });
   });
 
-module("Insanity");
+module('Insanity');
 
-  asyncTest("testInsanity", function() {
-    expect( 24 );
+  asyncTest('testInsanity', function() {
+    expect(24);
     var insanity = {
-      "1":{
-        "2":{
-          "userMap":{ "5":5, "8":8 },
-          "xtructs":[{
-              "string_thing":"Goodbye4",
-              "byte_thing":4,
-              "i32_thing":4,
-              "i64_thing":4
+      '1': {
+        '2': {
+          'userMap': { '5': 5, '8': 8 },
+          'xtructs': [{
+              'string_thing': 'Goodbye4',
+              'byte_thing': 4,
+              'i32_thing': 4,
+              'i64_thing': 4
             },
             {
-              "string_thing":"Hello2",
-              "byte_thing":2,
-              "i32_thing":2,
-              "i64_thing":2
+              'string_thing': 'Hello2',
+              'byte_thing': 2,
+              'i32_thing': 2,
+              'i64_thing': 2
             }
           ]
         },
-        "3":{
-          "userMap":{ "5":5, "8":8 },
-          "xtructs":[{
-              "string_thing":"Goodbye4",
-              "byte_thing":4,
-              "i32_thing":4,
-              "i64_thing":4
+        '3': {
+          'userMap': { '5': 5, '8': 8 },
+          'xtructs': [{
+              'string_thing': 'Goodbye4',
+              'byte_thing': 4,
+              'i32_thing': 4,
+              'i64_thing': 4
             },
             {
-              "string_thing":"Hello2",
-              "byte_thing":2,
-              "i32_thing":2,
-              "i64_thing":2
+              'string_thing': 'Hello2',
+              'byte_thing': 2,
+              'i32_thing': 2,
+              'i64_thing': 2
             }
           ]
         }
       },
-      "2":{ "6":{ "userMap":null, "xtructs":null } }
+      '2': { '6': { 'userMap': null, 'xtructs': null } }
     };
-    client.testInsanity(new ThriftTest.Insanity(), function(res){
+    client.testInsanity(new ThriftTest.Insanity(), function(res) {
       ok(res, JSON.stringify(res));
       ok(insanity, JSON.stringify(insanity));
       checkRecursively(res, insanity);
diff --git a/lib/js/test/test-jq.js b/lib/js/test/test-jq.js
index 23ed60f..d8649a0 100644
--- a/lib/js/test/test-jq.js
+++ b/lib/js/test/test-jq.js
@@ -33,27 +33,27 @@
 //////////////////////////////////
 //jQuery asynchronous tests
 jQuery.ajaxSetup({ timeout: 0 });
-$(document).ajaxError( function() { QUnit.start(); } );
+$(document).ajaxError(function() { QUnit.start(); });
 
-module("jQ Async Manual");
+module('jQ Async Manual');
 
-  test("testI32", function() {
-    expect( 2 );
+  test('testI32', function() {
+    expect(2);
     QUnit.stop();
 
     var transport = new Thrift.Transport();
-    var protocol  = new Thrift.Protocol(transport);
-    var client    = new ThriftTest.ThriftTestClient(protocol);
+    var protocol = new Thrift.Protocol(transport);
+    var client = new ThriftTest.ThriftTestClient(protocol);
 
     var jqxhr = jQuery.ajax({
-      url: "/service",
-      data: client.send_testI32(Math.pow(-2,31)),
-      type: "POST",
+      url: '/service',
+      data: client.send_testI32(Math.pow(-2, 31)),
+      type: 'POST',
       cache: false,
-      dataType: "text",
-      success: function(res){
-        transport.setRecvBuffer( res );
-        equal(client.recv_testI32(), Math.pow(-2,31));
+      dataType: 'text',
+      success: function(res) {
+        transport.setRecvBuffer(res);
+        equal(client.recv_testI32(), Math.pow(-2, 31));
       },
       error: function() { ok(false); },
       complete: function() {
@@ -63,25 +63,25 @@
     });
   });
 
-  test("testI64", function() {
-    expect( 2 );
+  test('testI64', function() {
+    expect(2);
     QUnit.stop();
 
     var transport = new Thrift.Transport();
-    var protocol  = new Thrift.Protocol(transport);
-    var client    = new ThriftTest.ThriftTestClient(protocol);
+    var protocol = new Thrift.Protocol(transport);
+    var client = new ThriftTest.ThriftTestClient(protocol);
 
     jQuery.ajax({
-      url: "/service",
+      url: '/service',
       //This is usually 2^61 but JS cannot represent anything over 2^52 accurately
-      data: client.send_testI64(Math.pow(-2,52)),
-      type: "POST",
+      data: client.send_testI64(Math.pow(-2, 52)),
+      type: 'POST',
       cache: false,
-      dataType: "text",
-      success: function(res){
-        transport.setRecvBuffer( res );
+      dataType: 'text',
+      success: function(res) {
+        transport.setRecvBuffer(res);
         //This is usually 2^61 but JS cannot represent anything over 2^52 accurately
-        equal(client.recv_testI64(), Math.pow(-2,52));
+        equal(client.recv_testI64(), Math.pow(-2, 52));
       },
       error: function() { ok(false); },
       complete: function() {
@@ -92,46 +92,46 @@
   });
 
 
-module("jQ Async");
-  test("I32", function() {
-    expect( 3 );
+module('jQ Async');
+  test('I32', function() {
+    expect(3);
 
     QUnit.stop();
-    client.testI32(Math.pow(2,30), function(result) {
-      equal(result, Math.pow(2,30));
+    client.testI32(Math.pow(2, 30), function(result) {
+      equal(result, Math.pow(2, 30));
       QUnit.start();
     });
 
     QUnit.stop();
-    var jqxhr = client.testI32(Math.pow(-2,31), function(result) {
-      equal(result, Math.pow(-2,31));
+    var jqxhr = client.testI32(Math.pow(-2, 31), function(result) {
+      equal(result, Math.pow(-2, 31));
     });
 
     jqxhr.success(function(result) {
-      equal(result, Math.pow(-2,31));
+      equal(result, Math.pow(-2, 31));
       QUnit.start();
     });
   });
 
-  test("I64", function() {
-    expect( 4 );
+  test('I64', function() {
+    expect(4);
 
     QUnit.stop();
     //This is usually 2^60 but JS cannot represent anything over 2^52 accurately
-    client.testI64(Math.pow(2,52), function(result) {
-      equal(result, Math.pow(2,52));
+    client.testI64(Math.pow(2, 52), function(result) {
+      equal(result, Math.pow(2, 52));
       QUnit.start();
     });
 
     QUnit.stop();
     //This is usually 2^60 but JS cannot represent anything over 2^52 accurately
-    client.testI64(Math.pow(-2,52), function(result) {
-      equal(result, Math.pow(-2,52));
+    client.testI64(Math.pow(-2, 52), function(result) {
+      equal(result, Math.pow(-2, 52));
     })
-    .error( function(xhr, status, e) {  ok(false, e.message); } )
+    .error(function(xhr, status, e) { ok(false, e.message); })
     .success(function(result) {
       //This is usually 2^60 but JS cannot represent anything over 2^52 accurately
-      equal(result, Math.pow(-2,52));
+      equal(result, Math.pow(-2, 52));
     })
     .complete(function() {
       ok(true);
@@ -139,18 +139,18 @@
     });
   });
 
-  test("Xception", function() {
-    expect( 2 );
+  test('Xception', function() {
+    expect(2);
 
     QUnit.stop();
 
-    var dfd = client.testException("Xception", function(result) {
+    var dfd = client.testException('Xception', function(result) {
       ok(false);
       QUnit.start();
     })
-    .error(function(xhr, status, e){
+    .error(function(xhr, status, e) {
       equal(e.errorCode, 1001);
-      equal(e.message, "Xception");
+      equal(e.message, 'Xception');
       //QUnit.start();
       //Note start is not required here because:
       //$(document).ajaxError( function() { QUnit.start(); } );
diff --git a/lib/js/test/test-nojq.js b/lib/js/test/test-nojq.js
index 19f9e61..c4f3cf7 100644
--- a/lib/js/test/test-nojq.js
+++ b/lib/js/test/test-nojq.js
@@ -17,7 +17,7 @@
  * under the License.
  */
  /* jshint -W100 */
- 
+
 /*
  * JavaScript test suite for ThriftTest.thrift. These tests
  * will run only with normal "-gen js" Apache Thrift interfaces.
@@ -25,7 +25,7 @@
  *      $ thrift -gen js ThriftTest.thrift
  *
  * See also:
- * ++ test.js for generic tests  
+ * ++ test.js for generic tests
  * ++ test-jq.js for "-gen js:jquery" only tests
  */
 
@@ -33,16 +33,16 @@
 //////////////////////////////////
 //Async exception tests
 
-module("NojQ Async");
+module('NojQ Async');
 
-  test("Xception", function() {
-    expect( 2 );
+  test('Xception', function() {
+    expect(2);
 
     QUnit.stop();
 
-    client.testException("Xception", function(result) {
+    client.testException('Xception', function(result) {
       equal(result.errorCode, 1001);
-      equal(result.message, "Xception");
+      equal(result.message, 'Xception');
       QUnit.start();
     });
   });
diff --git a/lib/js/test/test.js b/lib/js/test/test.js
index 2d8ec9b..e3b8d51 100755
--- a/lib/js/test/test.js
+++ b/lib/js/test/test.js
@@ -23,7 +23,7 @@
  * will run against Normal (-gen js) and jQuery (-gen js:jquery)
  * Apache Thrift interfaces.
  *
- * Synchronous blocking calls should be identical in both 
+ * Synchronous blocking calls should be identical in both
  * Normal and jQuery interfaces. All synchronous tests belong
  * here.
  *
@@ -47,9 +47,9 @@
  * ++ test-jq.js for "-gen js:jquery" only tests
  */
 
-var transport = new Thrift.Transport("/service");
-var protocol  = new Thrift.Protocol(transport);
-var client    = new ThriftTest.ThriftTestClient(protocol);
+var transport = new Thrift.Transport('/service');
+var protocol = new Thrift.Protocol(transport);
+var client = new ThriftTest.ThriftTestClient(protocol);
 
 // Work around for old API used by QUnitAdapter of jsTestDriver
 if (typeof QUnit.log == 'function') {
@@ -81,19 +81,19 @@
   }
 }
 
-module("Base Types");
+module('Base Types');
 
-  test("Void", function() {
+  test('Void', function() {
     equal(client.testVoid(), undefined);
   });
-  test("Binary (String)", function() {
+  test('Binary (String)', function() {
     var binary = '';
     for (var v = 255; v >= 0; --v) {
       binary += String.fromCharCode(v);
     }
     equal(client.testBinary(binary), binary);
   });
-  test("Binary (Uint8Array)", function() {
+  test('Binary (Uint8Array)', function() {
     var binary = '';
     for (var v = 255; v >= 0; --v) {
       binary += String.fromCharCode(v);
@@ -104,7 +104,7 @@
     }
     equal(client.testBinary(arr), binary);
   });
-  test("String", function() {
+  test('String', function() {
     equal(client.testString(''), '');
     equal(client.testString(stringTest), stringTest);
 
@@ -113,40 +113,40 @@
           ' backspace: \b formfeed: \f newline: \n return: \r tab: ' +
           ' now-all-of-them-together: "\\\/\b\n\r\t' +
           ' now-a-bunch-of-junk: !@#$%&()(&%$#{}{}<><><';
-    equal(client.testString(specialCharacters),specialCharacters);
+    equal(client.testString(specialCharacters), specialCharacters);
   });
-  test("Double", function() {
+  test('Double', function() {
     equal(client.testDouble(0), 0);
     equal(client.testDouble(-1), -1);
     equal(client.testDouble(3.14), 3.14);
-    equal(client.testDouble(Math.pow(2,60)), Math.pow(2,60));
+    equal(client.testDouble(Math.pow(2, 60)), Math.pow(2, 60));
   });
-  test("Byte", function() {
+  test('Byte', function() {
     equal(client.testByte(0), 0);
     equal(client.testByte(0x01), 0x01);
   });
-  test("I32", function() {
+  test('I32', function() {
     equal(client.testI32(0), 0);
-    equal(client.testI32(Math.pow(2,30)), Math.pow(2,30));
-    equal(client.testI32(-Math.pow(2,30)), -Math.pow(2,30));
+    equal(client.testI32(Math.pow(2, 30)), Math.pow(2, 30));
+    equal(client.testI32(-Math.pow(2, 30)), -Math.pow(2, 30));
   });
-  test("I64", function() {
+  test('I64', function() {
     equal(client.testI64(0), 0);
     //This is usually 2^60 but JS cannot represent anything over 2^52 accurately
-    equal(client.testI64(Math.pow(2,52)), Math.pow(2,52));
-    equal(client.testI64(-Math.pow(2,52)), -Math.pow(2,52));
+    equal(client.testI64(Math.pow(2, 52)), Math.pow(2, 52));
+    equal(client.testI64(-Math.pow(2, 52)), -Math.pow(2, 52));
   });
 
 
-module("Structured Types");
+module('Structured Types');
 
-  test("Struct", function() {
+  test('Struct', function() {
     var structTestInput = new ThriftTest.Xtruct();
     structTestInput.string_thing = 'worked';
     structTestInput.byte_thing = 0x01;
-    structTestInput.i32_thing = Math.pow(2,30);
+    structTestInput.i32_thing = Math.pow(2, 30);
     //This is usually 2^60 but JS cannot represent anything over 2^52 accurately
-    structTestInput.i64_thing = Math.pow(2,52);
+    structTestInput.i64_thing = Math.pow(2, 52);
 
     var structTestOutput = client.testStruct(structTestInput);
 
@@ -158,18 +158,18 @@
     equal(JSON.stringify(structTestOutput), JSON.stringify(structTestInput));
   });
 
-  test("Nest", function() {
+  test('Nest', function() {
     var xtrTestInput = new ThriftTest.Xtruct();
     xtrTestInput.string_thing = 'worked';
     xtrTestInput.byte_thing = 0x01;
-    xtrTestInput.i32_thing = Math.pow(2,30);
+    xtrTestInput.i32_thing = Math.pow(2, 30);
     //This is usually 2^60 but JS cannot represent anything over 2^52 accurately
-    xtrTestInput.i64_thing = Math.pow(2,52);
+    xtrTestInput.i64_thing = Math.pow(2, 52);
 
     var nestTestInput = new ThriftTest.Xtruct2();
     nestTestInput.byte_thing = 0x02;
     nestTestInput.struct_thing = xtrTestInput;
-    nestTestInput.i32_thing = Math.pow(2,15);
+    nestTestInput.i32_thing = Math.pow(2, 15);
 
     var nestTestOutput = client.testNest(nestTestInput);
 
@@ -183,8 +183,8 @@
     equal(JSON.stringify(nestTestOutput), JSON.stringify(nestTestInput));
   });
 
-  test("Map", function() {
-    var mapTestInput = {7:77, 8:88, 9:99};
+  test('Map', function() {
+    var mapTestInput = {7: 77, 8: 88, 9: 99};
 
     var mapTestOutput = client.testMap(mapTestInput);
 
@@ -193,10 +193,10 @@
     }
   });
 
-  test("StringMap", function() {
+  test('StringMap', function() {
     var mapTestInput = {
-      "a":"123", "a b":"with spaces ", "same":"same", "0":"numeric key",
-      "longValue":stringTest, stringTest:"long key"
+      'a': '123', 'a b': 'with spaces ', 'same': 'same', '0': 'numeric key',
+      'longValue': stringTest, stringTest: 'long key'
     };
 
     var mapTestOutput = client.testStringMap(mapTestInput);
@@ -206,30 +206,30 @@
     }
   });
 
-  test("Set", function() {
-    var setTestInput = [1,2,3];
+  test('Set', function() {
+    var setTestInput = [1, 2, 3];
     ok(client.testSet(setTestInput), setTestInput);
   });
 
-  test("List", function() {
-    var listTestInput = [1,2,3];
+  test('List', function() {
+    var listTestInput = [1, 2, 3];
     ok(client.testList(listTestInput), listTestInput);
   });
 
-  test("Enum", function() {
+  test('Enum', function() {
     equal(client.testEnum(ThriftTest.Numberz.ONE), ThriftTest.Numberz.ONE);
   });
 
-  test("TypeDef", function() {
+  test('TypeDef', function() {
     equal(client.testTypedef(69), 69);
   });
 
-  test("Skip", function() {
+  test('Skip', function() {
     var structTestInput = new ThriftTest.Xtruct();
     var modifiedClient = new ThriftTest.ThriftTestClient(protocol);
 
     modifiedClient.recv_testStruct = function() {
-      var input  = modifiedClient.input;
+      var input = modifiedClient.input;
       var xtruct3 = new ThriftTest.Xtruct3();
 
       input.readMessageBegin();
@@ -250,9 +250,9 @@
     };
 
     structTestInput.string_thing = 'worked';
-    structTestInput.byte_thing   = 0x01;
-    structTestInput.i32_thing    = Math.pow(2,30);
-    structTestInput.i64_thing    = Math.pow(2,52);
+    structTestInput.byte_thing = 0x01;
+    structTestInput.i32_thing = Math.pow(2, 30);
+    structTestInput.i64_thing = Math.pow(2, 52);
 
     var structTestOutput = modifiedClient.testStruct(structTestInput);
 
@@ -264,12 +264,12 @@
   });
 
 
-module("deeper!");
+module('deeper!');
 
-  test("MapMap", function() {
+  test('MapMap', function() {
     var mapMapTestExpectedResult = {
-      "4":{"1":1,"2":2,"3":3,"4":4},
-      "-4":{"-4":-4, "-3":-3, "-2":-2, "-1":-1}
+      '4': {'1': 1, '2': 2, '3': 3, '4': 4},
+      '-4': {'-4': -4, '-3': -3, '-2': -2, '-1': -1}
     };
 
     var mapMapTestOutput = client.testMapMap(1);
@@ -285,64 +285,64 @@
   });
 
 
-module("Exception");
+module('Exception');
 
-  test("Xception", function() {
+  test('Xception', function() {
     expect(2);
-    try{
-      client.testException("Xception");
-    }catch(e){
+    try {
+      client.testException('Xception');
+    }catch (e) {
       equal(e.errorCode, 1001);
-      equal(e.message, "Xception");
+      equal(e.message, 'Xception');
     }
   });
 
-  test("no Exception", 0, function() {
-    try{
-      client.testException("no Exception");
-    }catch(e){
+  test('no Exception', 0, function() {
+    try {
+      client.testException('no Exception');
+    }catch (e) {
       ok(false);
     }
   });
 
-  test("TException", function() {
+  test('TException', function() {
     //ThriftTest does not list TException as a legal exception so it will
     // generate an exception on the server that does not propagate back to
     // the client. This test has been modified to equate to "no exception"
     expect(1);
-    try{
-      client.testException("TException");
-    } catch(e) {
+    try {
+      client.testException('TException');
+    } catch (e) {
       //ok(false);
     }
     ok(true);
   });
 
 
-module("Insanity");
+module('Insanity');
 
   var crazy = {
-    "userMap":{ "5":5, "8":8 },
-    "xtructs":[{
-      "string_thing":"Goodbye4",
-      "byte_thing":4,
-      "i32_thing":4,
-      "i64_thing":4
+    'userMap': { '5': 5, '8': 8 },
+    'xtructs': [{
+      'string_thing': 'Goodbye4',
+      'byte_thing': 4,
+      'i32_thing': 4,
+      'i64_thing': 4
     },
     {
-      "string_thing":"Hello2",
-      "byte_thing":2,
-      "i32_thing":2,
-      "i64_thing":2
+      'string_thing': 'Hello2',
+      'byte_thing': 2,
+      'i32_thing': 2,
+      'i64_thing': 2
     }]
   };
-  test("testInsanity", function() {
+  test('testInsanity', function() {
     var insanity = {
-      "1":{
-        "2":crazy,
-        "3":crazy
+      '1': {
+        '2': crazy,
+        '3': crazy
       },
-      "2":{ "6":{ "userMap":null, "xtructs":null } }
+      '2': { '6': { 'userMap': null, 'xtructs': null } }
     };
     var res = client.testInsanity(new ThriftTest.Insanity(crazy));
     ok(res, JSON.stringify(res));
@@ -355,10 +355,10 @@
 //////////////////////////////////
 //Run same tests asynchronously
 
-module("Async");
+module('Async');
 
-  test("Double", function() {
-    expect( 1 );
+  test('Double', function() {
+    expect(1);
 
     QUnit.stop();
     client.testDouble(3.14159265, function(result) {
@@ -367,8 +367,8 @@
     });
   });
 
-  test("Byte", function() {
-    expect( 1 );
+  test('Byte', function() {
+    expect(1);
 
     QUnit.stop();
     client.testByte(0x01, function(result) {
@@ -377,36 +377,36 @@
     });
   });
 
-  test("I32", function() {
-    expect( 2 );
+  test('I32', function() {
+    expect(2);
 
     QUnit.stop();
-    client.testI32(Math.pow(2,30), function(result) {
-      equal(result, Math.pow(2,30));
+    client.testI32(Math.pow(2, 30), function(result) {
+      equal(result, Math.pow(2, 30));
       QUnit.start();
     });
 
     QUnit.stop();
-    client.testI32(Math.pow(-2,31), function(result) {
-      equal(result, Math.pow(-2,31));
+    client.testI32(Math.pow(-2, 31), function(result) {
+      equal(result, Math.pow(-2, 31));
       QUnit.start();
     });
   });
 
-  test("I64", function() {
-    expect( 2 );
+  test('I64', function() {
+    expect(2);
 
     QUnit.stop();
     //This is usually 2^60 but JS cannot represent anything over 2^52 accurately
-    client.testI64(Math.pow(2,52), function(result) {
-      equal(result, Math.pow(2,52));
+    client.testI64(Math.pow(2, 52), function(result) {
+      equal(result, Math.pow(2, 52));
       QUnit.start();
     });
 
     QUnit.stop();
     //This is usually 2^60 but JS cannot represent anything over 2^52 accurately
-    client.testI64(Math.pow(-2,52), function(result) {
-      equal(result, Math.pow(-2,52));
+    client.testI64(Math.pow(-2, 52), function(result) {
+      equal(result, Math.pow(-2, 52));
       QUnit.start();
     });
   });
diff --git a/lib/js/test/test_handler.js b/lib/js/test/test_handler.js
index e1fa74f..496b5e0 100644
--- a/lib/js/test/test_handler.js
+++ b/lib/js/test/test_handler.js
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-//This is the server side Node test handler for the standard 
+//This is the server side Node test handler for the standard
 //  Apache Thrift test service.
 
 var ttypes = require('./gen-nodejs/ThriftTest_types');
@@ -162,7 +162,7 @@
     result(null, hello);
   },
   testException: function(arg, result) {
-    console.log('testException('+arg+')');
+    console.log('testException(' + arg + ')');
     if (arg === 'Xception') {
       var x = new ttypes.Xception();
       x.errorCode = 1001;
