@@ -12,6 +12,7 @@ var nodeunit = require('../nodeunit'),
1212 utils = require ( '../utils' ) ,
1313 fs = require ( 'fs' ) ,
1414 path = require ( 'path' ) ,
15+ track = require ( '../track' ) ,
1516 AssertionError = require ( 'assert' ) . AssertionError ;
1617
1718/**
@@ -52,6 +53,23 @@ exports.run = function (files, options, callback) {
5253
5354 var start = new Date ( ) . getTime ( ) ;
5455
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+
5573 var opts = {
5674 testspec : options . testspec ,
5775 testFullSpec : options . testFullSpec ,
@@ -76,9 +94,12 @@ exports.run = function (files, options, callback) {
7694 }
7795
7896 } ,
79- testStart : function ( ) {
97+ testStart : function ( name ) {
98+ tracker . put ( name ) ;
8099 } ,
81100 testDone : function ( name , assertions ) {
101+ tracker . remove ( name ) ;
102+
82103 if ( ! assertions . failures ( ) ) {
83104 process . stdout . write ( '.' ) ;
84105 }
0 commit comments