[Pkg-javascript-commits] [node-acorn-jsx] 345/484: Add support for nested groups in log (Chrome console + browser).

Bastien Roucariès rouca at moszumanska.debian.org
Sat Aug 19 14:20:54 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-acorn-jsx.

commit bc64d3c5f4a96c7540697a7624addd7d563c0ed1
Author: Ingvar Stepanyan <me at rreverser.com>
Date:   Tue Nov 4 02:01:02 2014 +0200

    Add support for nested groups in log (Chrome console + browser).
---
 test/run.js | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/test/run.js b/test/run.js
index fefcaed..04f752d 100644
--- a/test/run.js
+++ b/test/run.js
@@ -10,15 +10,16 @@
   }
 
   var htmlLog = typeof document === "object" && document.getElementById('log');
-  var htmlGroup;
+  var htmlGroup = htmlLog;
 
   function group(name) {
-    if (htmlLog) {
+    if (htmlGroup) {
+      var parentGroup = htmlGroup;
       htmlGroup = document.createElement("ul");
       var item = document.createElement("li");
       item.textContent = name;
       item.appendChild(htmlGroup);
-      htmlLog.appendChild(item);
+      parentGroup.appendChild(item);
     }
     if (typeof console === "object" && console.group) {
       console.group(name);
@@ -26,7 +27,9 @@
   }
 
   function groupEnd() {
-    htmlGroup = null;
+    if (htmlGroup) {
+      htmlGroup = htmlGroup.parentElement.parentElement;
+    }
     if (typeof console === "object" && console.groupEnd) {
       console.groupEnd(name);
     }
@@ -68,11 +71,13 @@
   group("Errors");
 
   for (var name in modes) {
+    group(name);
     var mode = modes[name];
     stats = mode.stats = {testsRun: 0, failed: 0};
     var t0 = +new Date;
     driver.runTests(mode.config, report);
     mode.stats.duration = +new Date - t0;
+    groupEnd();
   }
 
   groupEnd();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-acorn-jsx.git



More information about the Pkg-javascript-commits mailing list