@@ -27,6 +27,25 @@ module.exports = function() {
2727 }
2828 } ) ;
2929
30+ var queueList = [ ] ,
31+ queueRunning = false ;
32+ function queue ( func ) {
33+ if ( queueRunning ) {
34+ queueList . push ( func ) ;
35+ } else {
36+ queueRunning = true ;
37+ func ( ) ;
38+ }
39+ }
40+ function release ( ) {
41+ if ( queueList . length ) {
42+ var func = queueList . shift ( ) ;
43+ func ( ) ;
44+ } else {
45+ queueRunning = false ;
46+ }
47+ } ;
48+
3049
3150 var totalTests = 0 ,
3251 failedTests = 0 ,
@@ -103,6 +122,7 @@ module.exports = function() {
103122 }
104123
105124 function testSyncronous ( options , filenameNoExtension ) {
125+ queue ( function ( ) {
106126 var isSync = true ;
107127 totalTests ++ ;
108128 toCSS ( options , path . join ( 'test/less/' , filenameNoExtension + ".less" ) , function ( err , result ) {
@@ -115,6 +135,7 @@ module.exports = function() {
115135 }
116136 } ) ;
117137 isSync = false ;
138+ } ) ;
118139 }
119140
120141 function runTestSet ( options , foldername , verifyFunction , nameModifier , doReplacements , getFilename ) {
@@ -151,6 +172,7 @@ module.exports = function() {
151172 return JSON . parse ( fs . readFileSync ( getFilename ( getBasename ( file ) , 'vars' ) , 'utf8' ) ) ;
152173 } ;
153174
175+ queue ( function ( ) {
154176 toCSS ( options , path . join ( 'test/less/' , foldername + file ) , function ( err , result ) {
155177
156178 if ( verifyFunction ) {
@@ -162,6 +184,7 @@ module.exports = function() {
162184 process . stdout . write ( "\n" ) ;
163185 process . stdout . write ( err . stack + "\n" ) ;
164186 }
187+ release ( ) ;
165188 return ;
166189 }
167190 var css_name = name ;
@@ -174,8 +197,10 @@ module.exports = function() {
174197 else {
175198 difference ( "FAIL" , css , result . css ) ;
176199 }
200+ release ( ) ;
177201 } ) ;
178202 } ) ;
203+ } ) ;
179204 } ) ;
180205 }
181206
0 commit comments