示例#1
0
文件: launcher.js 项目: mcollina/vows
launcher.prototype.msg = function msg(cmd, subject, str, p) {
    if (this.options.verbose) {
        sys[p ? 'print' : 'puts']( stylize('vows ', 'green')
                                  + stylize(cmd, 'bold')
                                  + ' ' + subject + ' '
                                  + (str ? (typeof(str) === 'string' ? str : inspect(str)) : '')
                                 );
    }
};
示例#2
0
 function parse(str) {
     return str.replace(/{actual}/g,   inspect(that.actual)).
                replace(/{operator}/g, stylize(that.operator, 'bold')).
                replace(/{expected}/g, (that.expected instanceof Function)
                                       ? that.expected.name
                                       : inspect(that.expected));
 }
示例#3
0
require('assert').AssertionError.prototype.toString = function () {
    var that = this,
        source = this.stack.match(/([a-zA-Z0-9._-]+\.js)(:\d+):\d+/);

    function parse(str) {
        return str.replace(/{actual}/g,   inspect(that.actual)).
                   replace(/{operator}/g, stylize(that.operator, 'bold')).
                   replace(/{expected}/g, (that.expected instanceof Function)
                                          ? that.expected.name
                                          : inspect(that.expected));
    }

    if (this.message) {
        return stylize(parse(this.message), 'yellow') +
               stylize(' // ' + source[1] + source[2], 'grey');
    } else {
        return stylize([
            this.expected,
            this.operator,
            this.actual
        ].join(' '), 'yellow');
    }
};
示例#4
0
文件: launcher.js 项目: mcollina/vows
launcher.prototype.abort = function(cmd, str) {
    sys.puts(stylize('vows ', 'red') + stylize(cmd, 'bold') + ' ' + str);
    sys.puts(stylize('vows ', 'red') + stylize(cmd, 'bold') + ' exiting');
    process.exit(-1);
}