spec/browser/nodeunit.js
function (setUp, tearDown, fn) {
    return function (test) {
        var context = {};
        if (tearDown) {
            var done = test.done;
            test.done = function (err) {
                try {
                    tearDown.call(context, function (err2) {
                        if (err && err2) {
                            test._assertion_list.push(
                                types.assertion({error: err})
                            );
                            return done(err2);
                        }
                        done(err || err2);
                    });
                }
                catch (e) {
                    done(e);
                }
            };
        }
        if (setUp) {
            setUp.call(context, function (err) {
                if (err) {
                    return test.done(err);
                }
                fn.call(context, test);
            });
        }
        else {
            fn.call(context, test);
        }
    };
}
function (setUp, tearDown, fn) {
    return function (test) {
        var context = {};
        if (tearDown) {
            var done = test.done;
            test.done = function (err) {
                try {
                    tearDown.call(context, function (err2) {
                        if (err && err2) {
                            test._assertion_list.push(
                                types.assertion({error: err})
                            );
                            return done(err2);
                        }
                        done(err || err2);
                    });
                }
                catch (e) {
                    done(e);
                }
            };
        }
        if (setUp) {
            setUp.call(context, function (err) {
                if (err) {
                    return test.done(err);
                }
                fn.call(context, test);
            });
        }
        else {
            fn.call(context, test);
        }
    };
}
function ( setUp , tearDown , fn ) { return function ( test ) { var context = { } ; if ( tearDown ) { var done = test . done ; test . done = function ( err ) { try { tearDown . call ( context , function ( err2 ) { if ( err && err2 ) { test . _assertion_list . push ( types . assertion ( { error : err } ) ) ; return done ( err2 ) ; } done ( err || err2 ) ; } ) ; } catch ( e ) { done ( e ) ; } } ; } if ( setUp ) { setUp . call ( context , function ( err ) { if ( err ) { return test . done ( err ) ; } fn . call ( context , test ) ; } ) ; } else { fn . call ( context , test ) ; } } ; }
Wraps a test function with setUp and tearDown functions.
Used by testCase.

@param {Function} setUp
@param {Function} tearDown
@param {Function} fn
@api private
Wraps a test function with setUp and tearDown functions . Used by testCase .