@@ -34,7 +34,8 @@ exports.run = function (files, options) {
34
34
if ( ! options ) {
35
35
// load default options
36
36
var content = fs . readFileSync (
37
- __dirname + '/../../bin/nodeunit.json' , 'utf8'
37
+ __dirname + '/../../bin/nodeunit.json' ,
38
+ 'utf8'
38
39
) ;
39
40
options = JSON . parse ( content ) ;
40
41
}
@@ -57,13 +58,14 @@ exports.run = function (files, options) {
57
58
return path . join ( process . cwd ( ) , p ) ;
58
59
} ) ;
59
60
var tracker = track . createTracker ( function ( tracker ) {
61
+ var i , names ;
60
62
if ( tracker . unfinished ( ) ) {
61
63
console . log ( '' ) ;
62
64
console . log ( error ( bold (
63
65
'FAILURES: Undone tests (or their setups/teardowns): '
64
66
) ) ) ;
65
- var names = tracker . names ( ) ;
66
- for ( var i = 0 ; i < names . length ; i += 1 ) {
67
+ names = tracker . names ( ) ;
68
+ for ( i = 0 ; i < names . length ; i += 1 ) {
67
69
console . log ( '- ' + names [ i ] ) ;
68
70
}
69
71
console . log ( '' ) ;
@@ -76,15 +78,16 @@ exports.run = function (files, options) {
76
78
// i.e., whether this part has been printed yet.
77
79
tracker . already_printed = { } ;
78
80
79
- tracker . print_status = function ( status , name_arr ) {
81
+ tracker . print_status = function ( status , name_arr ) {
80
82
var txt = '' ;
81
83
var space = " " ;
82
- for ( var i = 0 ; i < name_arr . length ; i ++ ) {
83
- var part = name_arr . slice ( 0 , i + 1 ) . join ( "," ) ;
84
+ var part , i , k ;
85
+ for ( i = 0 ; i < name_arr . length ; i ++ ) {
86
+ part = name_arr . slice ( 0 , i + 1 ) . join ( "," ) ;
84
87
// Only print the part if it hasn't already been printed.
85
88
if ( ! tracker . already_printed [ part ] ) {
86
89
// Indent once for each nested level
87
- for ( var k = 0 ; k < i ; k ++ ) {
90
+ for ( k = 0 ; k < i ; k ++ ) {
88
91
txt += space ;
89
92
}
90
93
if ( i === name_arr . length - 1 ) {
@@ -95,7 +98,8 @@ exports.run = function (files, options) {
95
98
txt += bold ( error ( name_arr [ i ] + " (fail) ✖ " ) ) ;
96
99
}
97
100
} else {
98
- // This is a testCase, just print the testCase name and a newline.
101
+ // This is a testCase, just print the testCase name
102
+ // and a newline.
99
103
txt += name_arr [ i ] ;
100
104
txt += "\n" ;
101
105
}
@@ -115,16 +119,15 @@ exports.run = function (files, options) {
115
119
116
120
if ( ! assertions . failures ( ) ) {
117
121
tracker . print_status ( 'pass' , name ) ;
118
- }
119
- else {
122
+ } else {
120
123
tracker . print_status ( 'fail' , name ) ;
121
124
assertions . forEach ( function ( a ) {
122
125
if ( a . failed ( ) ) {
123
126
a = utils . betterErrors ( a ) ;
124
127
if ( a . error instanceof AssertionError && a . message ) {
125
128
console . log (
126
129
'Assertion Message: ' +
127
- assertion_message ( a . message )
130
+ assertion_message ( a . message )
128
131
) ;
129
132
}
130
133
console . log ( a . error . stack + '\n' ) ;
@@ -138,18 +141,17 @@ exports.run = function (files, options) {
138
141
if ( assertions . failures ( ) ) {
139
142
console . log (
140
143
'\n' + bold ( error ( 'FAILURES: ' ) ) + assertions . failures ( ) +
141
- '/' + assertions . length + ' assertions failed (' +
142
- assertions . duration + 'ms)'
144
+ '/' + assertions . length + ' assertions failed (' +
145
+ assertions . duration + 'ms)'
143
146
) ;
144
- }
145
- else {
147
+ } else {
146
148
console . log (
147
- '\n' + bold ( ok ( 'OK: ' ) ) + assertions . length +
148
- ' assertions (' + assertions . duration + 'ms)'
149
+ '\n' + bold ( ok ( 'OK: ' ) ) + assertions . length +
150
+ ' assertions (' + assertions . duration + 'ms)'
149
151
) ;
150
152
}
151
153
} ,
152
- testStart : function ( name ) {
154
+ testStart : function ( name ) {
153
155
tracker . put ( name ) ;
154
156
}
155
157
} ) ;
0 commit comments