Verify that something works

I'm going to go away as a commit
diff --git a/circle.yml b/circle.yml
index 8c35d92..e9cb681 100644
--- a/circle.yml
+++ b/circle.yml
@@ -52,6 +52,9 @@
     - make server:
         background: true
 
+    - node -e 'require("http").createServer(function(req, res) { res.setHeader("Access-Control-Allow-Origin", "*"); req.pipe(require("fs").createWriteStream("xunit")); req.on("end", res.end.bind(res)); }).listen(9000);':
+        background: true
+
     # Wait for tunnel to be ready (`make server` is much faster, no need to wait)
     - while [ ! -e ~/sauce_is_ready ]; do sleep 1; done
 
@@ -97,6 +100,10 @@
         [ "$(node -p 'require("./status.json").completed')" != false ] && break
       done
 
+    - mkdir -p $CIRCLE_TEST_REPORTS/mocha
+
+    - cat xunit > $CIRCLE_TEST_REPORTS/mocha/xunit.xml
+
     # finally, complain to Circle CI if there were nonzero test failures
     - |-
       [ "$(node -p 'require("./status.json")["js tests"][0].result.failures')" == 0 ]
diff --git a/test/unit.html b/test/unit.html
index b87cafa..80e7e00 100644
--- a/test/unit.html
+++ b/test/unit.html
@@ -24,7 +24,23 @@
 
     <!-- configure mocha and chai -->
     <script type="text/javascript">
-      mocha.setup('tdd');
+      mocha.setup({
+        ui: 'tdd',
+        reporter: 'xunit'
+      });
+
+      var console_log = console.log;
+      var xunit = "";
+      console.log = function() {
+        var str = arguments[0];
+
+        if (str === 'stdout:') {
+          xunit += arguments[1];
+        }
+
+        return console_log.apply(console, arguments);
+      };
+
     </script>
 
     <!-- include the library with the tests inlined -->
@@ -66,9 +82,45 @@
 
         failedTests.push({name: test.title, result: false, message: err.message, stack: err.stack, titles: flattenTitles(test) });
       });
+
       runner.on('end', function() {
-        window.mochaResults = runner.stats;
-        window.mochaResults.reports = failedTests;
+        setTimeout(function(){
+          //var data = {
+          //  "description": "Mathquill test",
+          //  "public": true,
+          //  "files": {
+          //    "file1.txt": {
+          //      "content": xunit
+          //    }
+          //  }
+          //};
+
+          //$.ajax({
+          //  url: "https://localhost:9000/",
+          //  data: xunit,
+          //  type: 'POST',
+          //  headers: {Connection: 'close'}
+          //})
+          //  .then(function(gist) {
+          //    window.mochaResults = runner.stats;
+          //    window.mochaResults.reports = failedTests;
+          //  });
+
+          $.post("http://localhost:9000/", xunit)
+            .then(function(gist) {
+              window.mochaResults = runner.stats;
+              window.mochaResults.reports = failedTests;
+            });
+
+          //$.post("https://api.github.com/gists", JSON.stringify(data))
+          //  .then(function(gist) {
+          //    runner.stats.xunitURL = gist.files["file1.txt"].raw_url
+          //      console.log(runner.stats.xunitURL)
+          //      window.mochaResults = runner.stats;
+          //    window.mochaResults.reports = failedTests;
+          //  });
+        });
+
       });
     </script>
   </body>