]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
updated qunit test reporting so sauce labs can report failing tests
authorjonahss <jonahss@gmail.com>
Thu, 20 Feb 2014 05:27:50 +0000 (21:27 -0800)
committerChris Rebert <code@rebertia.com>
Sat, 22 Feb 2014 02:54:50 +0000 (18:54 -0800)
js/tests/index.html

index 60f543abfc44acdffeff2ee2d46176ae1f5b49ef..c6d3d27af63589c488f80b78f6508863553e99e5 100644 (file)
   <script src="vendor/qunit.js"></script>
   <script>
     // See https://github.com/axemclion/grunt-saucelabs#test-result-details-with-qunit
-    QUnit.done(function (results) {
-      window.global_test_results = results
+    var log = []
+    QUnit.done = function (test_results) {
+      var tests = log.map(function (details) {
+        return {
+          name: details.name,
+          result: details.result,
+          expected: details.expected,
+          actual: details.actual,
+          source: details.source
+        }
+      })
+      test_results.tests = tests
+
+      // Delaying results a bit because in real-world scenario you won't get them immediately
+      setTimeout(function () {
+        window.global_test_results = test_results
+      }, 2000)
+    }
+
+    QUnit.testStart(function (testDetails) {
+      QUnit.log = function (details) {
+        if (!details.result) {
+          details.name = testDetails.name
+          log.push(details)
+        }
+      }
     })
   </script>