[Pkg-javascript-commits] [less.js] 08/10: run less tests one after another

Jonas Smedegaard dr at jones.dk
Mon Oct 26 23:26:33 UTC 2015


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

js pushed a commit to annotated tag v2.1.2
in repository less.js.

commit 8fc12e1b675a2542bf196454c059fc741b4018a4
Author: Luke Page <luke.a.page at gmail.com>
Date:   Fri Nov 28 19:46:49 2014 +0000

    run less tests one after another
---
 test/less-test.js | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/test/less-test.js b/test/less-test.js
index a481b57..2020a5c 100644
--- a/test/less-test.js
+++ b/test/less-test.js
@@ -27,6 +27,25 @@ module.exports = function() {
         }
     });
 
+    var queueList = [],
+        queueRunning = false;
+    function queue(func) {
+        if (queueRunning) {
+            queueList.push(func);
+        } else {
+            queueRunning = true;
+            func();
+        }
+    }
+    function release() {
+        if (queueList.length) {
+            var func = queueList.shift();
+            func();
+        } else {
+            queueRunning = false;
+        }
+    };
+
 
     var totalTests = 0,
         failedTests = 0,
@@ -103,6 +122,7 @@ module.exports = function() {
     }
 
     function testSyncronous(options, filenameNoExtension) {
+        queue(function() {
         var isSync = true;
         totalTests++;
         toCSS(options, path.join('test/less/', filenameNoExtension + ".less"), function (err, result) {
@@ -115,6 +135,7 @@ module.exports = function() {
             }
         });
         isSync = false;
+        });
     }
 
     function runTestSet(options, foldername, verifyFunction, nameModifier, doReplacements, getFilename) {
@@ -151,6 +172,7 @@ module.exports = function() {
                 return JSON.parse(fs.readFileSync(getFilename(getBasename(file), 'vars'), 'utf8'));
             };
 
+            queue(function() {
             toCSS(options, path.join('test/less/', foldername + file), function (err, result) {
 
                 if (verifyFunction) {
@@ -162,6 +184,7 @@ module.exports = function() {
                         process.stdout.write("\n");
                         process.stdout.write(err.stack + "\n");
                     }
+                    release();
                     return;
                 }
                 var css_name = name;
@@ -174,8 +197,10 @@ module.exports = function() {
                     else {
                         difference("FAIL", css, result.css);
                     }
+                    release();
                 });
             });
+            });
         });
     }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/less.js.git



More information about the Pkg-javascript-commits mailing list