@@ -8,6 +8,52 @@ T.results = [];
88T . running = false ;
99T . immediate = null ;
1010
11+ function NEXT ( ) {
12+
13+ T . immediate && clearImmediate ( T . immediate ) ;
14+ T . immediate = null ;
15+
16+ var fn = T . current ? T . current . items . shift ( ) : null ;
17+
18+ if ( fn != null ) {
19+ fn ( ) ;
20+ return ;
21+ }
22+
23+ if ( T . current ) {
24+ T . results . push ( T . current ) ;
25+ console . log ( '' ) ;
26+ }
27+
28+ var test = F . tests . tests . shift ( ) ;
29+ if ( test == null ) {
30+
31+ console . log ( '===================== RESULTS ======================' ) ;
32+ console . log ( '' ) ;
33+ console . log ( '> Passed .........' , T . countok + '/' + T . count ) ;
34+ console . log ( '> Failed ' + ( T . countno ? '[x] .....' : '.........' ) , T . countno + '/' + T . count ) ;
35+ console . log ( '' ) ;
36+
37+ F . isTest = false ;
38+ F . emit ( 'test-end' , T ) ;
39+
40+ // DONE
41+ setTimeout ( function ( ) {
42+ F . kill ( T . countno ? 1 : 0 ) ;
43+ } , 1000 ) ;
44+
45+ } else {
46+
47+ T . current = test ;
48+ T . current . results = [ ] ;
49+
50+ console . log ( '[ TEST: ' + test . filename . substring ( F . path . root ( '/tests/' ) . length ) + ( T . current . priority ? ' ({0}) ]' . format ( T . current . priority ) : ' ]' ) ) ;
51+ console . log ( '' ) ;
52+
53+ NEXT ( ) ;
54+ }
55+ }
56+
1157global . TEST = function ( name , url , scope ) {
1258
1359 if ( typeof ( url ) === 'function' ) {
@@ -59,52 +105,6 @@ global.OK = function(is, description) {
59105 T . immediate = setImmediate ( NEXT ) ;
60106} ;
61107
62- global . NEXT = function ( ) {
63-
64- T . immediate && clearImmediate ( T . immediate ) ;
65- T . immediate = null ;
66-
67- var fn = T . current ? T . current . items . shift ( ) : null ;
68-
69- if ( fn != null ) {
70- fn ( ) ;
71- return ;
72- }
73-
74- if ( T . current ) {
75- T . results . push ( T . current ) ;
76- console . log ( '' ) ;
77- }
78-
79- var test = F . tests . tests . shift ( ) ;
80- if ( test == null ) {
81-
82- console . log ( '===================== RESULTS ======================' ) ;
83- console . log ( '' ) ;
84- console . log ( '> Passed .........' , T . countok + '/' + T . count ) ;
85- console . log ( '> Failed ' + ( T . countno ? '[x] .....' : '.........' ) , T . countno + '/' + T . count ) ;
86- console . log ( '' ) ;
87-
88- F . isTest = false ;
89- F . emit ( 'test-end' , T ) ;
90-
91- // DONE
92- setTimeout ( function ( ) {
93- F . kill ( T . countno ? 1 : 0 ) ;
94- } , 1000 ) ;
95-
96- } else {
97-
98- T . current = test ;
99- T . current . results = [ ] ;
100-
101- console . log ( '[ TEST: ' + test . filename . substring ( F . path . root ( '/tests/' ) . length ) + ( T . current . priority ? ' ({0}) ]' . format ( T . current . priority ) : ' ]' ) ) ;
102- console . log ( '' ) ;
103-
104- NEXT ( ) ;
105- }
106- } ;
107-
108108exports . load = function ( ) {
109109 U . ls ( F . path . root ( '/tests/' ) , function ( files ) {
110110 files . waitFor ( function ( filename , next ) {
0 commit comments