@@ -12,6 +12,7 @@ var nodeunit = require('../nodeunit'),
12
12
utils = require ( '../utils' ) ,
13
13
fs = require ( 'fs' ) ,
14
14
path = require ( 'path' ) ,
15
+ track = require ( '../track' ) ,
15
16
AssertionError = require ( 'assert' ) . AssertionError ;
16
17
17
18
/**
@@ -52,6 +53,23 @@ exports.run = function (files, options, callback) {
52
53
53
54
var start = new Date ( ) . getTime ( ) ;
54
55
56
+ var tracker = track . createTracker ( function ( tracker ) {
57
+ if ( tracker . unfinished ( ) ) {
58
+ console . log ( '' ) ;
59
+ console . log ( bold ( red (
60
+ 'FAILURES: Undone tests (or their setups/teardowns): '
61
+ ) ) ) ;
62
+ var names = tracker . names ( ) ;
63
+ for ( var i = 0 ; i < names . length ; i += 1 ) {
64
+ console . log ( '- ' + names [ i ] ) ;
65
+ }
66
+ console . log ( '' ) ;
67
+ console . log ( 'To fix this, make sure all tests call test.done()' ) ;
68
+ process . reallyExit ( tracker . unfinished ( ) ) ;
69
+ }
70
+ } ) ;
71
+
72
+
55
73
var opts = {
56
74
testspec : options . testspec ,
57
75
testFullSpec : options . testFullSpec ,
@@ -76,9 +94,12 @@ exports.run = function (files, options, callback) {
76
94
}
77
95
78
96
} ,
79
- testStart : function ( ) {
97
+ testStart : function ( name ) {
98
+ tracker . put ( name ) ;
80
99
} ,
81
100
testDone : function ( name , assertions ) {
101
+ tracker . remove ( name ) ;
102
+
82
103
if ( ! assertions . failures ( ) ) {
83
104
process . stdout . write ( '.' ) ;
84
105
}
0 commit comments