Name: js-handler/node_modules/nodeunit/lib/track.js 
1:
/*!
2:
 * Simple util module to track tests. Adds a process.exit hook to print
3:
 * the undone tests.
4:
 */
5:
 
6:
 
7:
exports.createTracker = function (on_exit) {
8:
    var names = {};
9:
    var tracker = {
10:
        names: function () {
11:
            var arr = [];
12:
            for (var k in names) {
13:
                if (names.hasOwnProperty(k)) {
14:
                    arr.push(k);
15:
                }
16:
            }
17:
            return arr;
18:
        },
19:
        unfinished: function () {
20:
            return tracker.names().length;
21:
        },
22:
        put: function (testname) {
23:
            names[testname] = testname;
24:
        },
25:
        remove: function (testname) {
26:
            delete names[testname];
27:
        }
28:
    };
29:
 
30:
    process.on('exit', function() {
31:
        on_exit = on_exit || exports.default_on_exit;
32:
        on_exit(tracker);
33:
    });
34:
 
35:
    return tracker;
36:
};
37:
 
38:
exports.default_on_exit = function (tracker) {
39:
    if (tracker.unfinished()) {
40:
        console.log('');
41:
        console.log('Undone tests (or their setups/teardowns): ');
42:
        var names = tracker.names();
43:
        for (var i = 0; i < names.length; i += 1) {
44:
            console.log(names[i]);
45:
        }
46:
        process.reallyExit(tracker.unfinished());
47:
    }
48:
};