THRIFT-2350 Add async calls to normal JavaScript
Patch: Randy Abernethy
diff --git a/lib/js/Gruntfile.js b/lib/js/Gruntfile.js
index dd6406b..9a8bb0d 100644
--- a/lib/js/Gruntfile.js
+++ b/lib/js/Gruntfile.js
@@ -35,12 +35,32 @@
           'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
         }
       }
+    },  
+    shell: {
+      InstallThriftJS: {
+        command: 'mkdir test/build; mkdir test/build/js; cp src/thrift.js test/build/js/thrift.js'
+      },
+      ThriftGen: {
+        command: 'thrift -gen js -gen js:node -o test ../../test/ThriftTest.thrift'
+      }
+    },
+    external_daemon: {
+      ThriftTestServer: {
+        options: {
+          startCheck: function(stdout, stderr) {
+            return (/Thrift Server running on port/).test(stdout);
+          },
+          nodeSpawnOptions: {cwd: "test"}
+        },
+        cmd: "node",
+        args: ["server_http.js"]
+      }
     },
     qunit: {
       all: {
         options: {
           urls: [
-            'http://localhost:8088/test.html'
+            'http://localhost:8088/test-nojq.html'
           ]
         }
       }
@@ -64,7 +84,9 @@
   grunt.loadNpmTasks('grunt-contrib-qunit');
   grunt.loadNpmTasks('grunt-contrib-concat');
   grunt.loadNpmTasks('grunt-jsdoc');
+  grunt.loadNpmTasks('grunt-external-daemon');
+  grunt.loadNpmTasks('grunt-shell');
 
-  grunt.registerTask('test', ['jshint', 'qunit']);
-  grunt.registerTask('default', ['jshint', 'qunit', 'concat', 'uglify', 'jsdoc']);
-};
\ No newline at end of file
+  grunt.registerTask('test', ['jshint', 'shell', 'external_daemon', 'qunit']);
+  grunt.registerTask('default', ['jshint', 'shell', 'external_daemon', 'qunit', 'concat', 'uglify', 'jsdoc']);
+};