function formatTestValue(value, name) {
    "use strict";
    var formatted = '';
    if (value instanceof Error) {
        formatted += value.message + '\n';
        if (value.stack) {
            formatted += indent(value.stack, 12, '#');
        }
    } else if (name === 'stack') {
        if (isArray(value)) {
            formatted += value.map(function(entry) {
                return format('in %s() in %s:%d', (entry['function'] || "anonymous"), entry.file, entry.line);
            }).join('\n');
        } else {
            formatted += 'not provided';
        }
    } else {
        try {
            formatted += serialize(value);
        } catch (e) {
            try {
                formatted += serialize(value.toString());
            } catch (e2) {
                formatted += '(unserializable value)';
            }
        }
    }
    return formatted;
}
Formats a test value.

@param  Mixed  value
@return String