Comparing version 0.5.9 to 0.5.10
@@ -35,8 +35,14 @@ var eyes = require('eyes').inspector({ stream: null, styles: false }); | ||
var stylize = exports.stylize; | ||
options.stream || (options.stream = process.stdout); | ||
options.tail = options.tail || ''; | ||
return function (args) { | ||
args = Array.prototype.slice.call(arguments).map(function (a) { | ||
return a.replace(/`([^`]+)`/g, function (_, capture) { return stylize(capture, 'italic') }) | ||
.replace(/\*([^*]+)\*/g, function (_, capture) { return stylize(capture, 'bold') }); | ||
}); | ||
return options.stream.write(args.join('\n') + '\n'); | ||
args = Array.prototype.slice.call(arguments); | ||
if (!options.raw) { | ||
args = args.map(function (a) { | ||
return a.replace(/`([^`]+)`/g, function (_, capture) { return stylize(capture, 'italic') }) | ||
.replace(/\*([^*]+)\*/g, function (_, capture) { return stylize(capture, 'bold') }); | ||
}); | ||
} | ||
return options.stream.write(args.join('\n') + options.tail); | ||
}; | ||
@@ -77,3 +83,3 @@ }; | ||
} | ||
buffer.push(header + result + time); | ||
buffer.push(header + result + time + '\n'); | ||
@@ -96,1 +102,33 @@ return buffer; | ||
}; | ||
this.contextText = function (event) { | ||
return ' ' + event; | ||
}; | ||
this.vowText = function (event) { | ||
var buffer = []; | ||
buffer.push(' ' + { | ||
honored: ' ✓ ', | ||
broken: ' ✗ ', | ||
errored: ' ✗ ', | ||
pending: ' - ' | ||
}[event.status] + this.stylize(event.title, ({ | ||
honored: 'green', | ||
broken: 'yellow', | ||
errored: 'red', | ||
pending: 'cyan' | ||
})[event.status])); | ||
if (event.status === 'broken') { | ||
buffer.push(' » ' + event.exception); | ||
} else if (event.status === 'errored') { | ||
if (event.exception.type === 'promise') { | ||
buffer.push(' » ' + this.stylize("An unexpected error was caught: " + | ||
this.stylize(event.exception.error, 'bold'), 'red')); | ||
} else { | ||
buffer.push(' ' + this.stylize(event.exception, 'red')); | ||
} | ||
} | ||
return buffer.join('\n'); | ||
}; |
@@ -7,2 +7,11 @@ var sys = require('sys'), | ||
function getCoverageClass( data ) { | ||
var fullCoverage= (data.coverage == 100); | ||
var okCoverage= (!fullCoverage && data.coverage >=60); | ||
var coverageClass= ''; | ||
if( fullCoverage ) coverageClass= 'fullCoverage'; | ||
else if( okCoverage) coverageClass= 'okCoverage'; | ||
else coverageClass= 'poorCoverage'; | ||
return coverageClass; | ||
} | ||
this.report = function (coverageMap) { | ||
@@ -25,8 +34,8 @@ var out, head, foot; | ||
var data = file.coverage(filename, coverageMap[filename]); | ||
var coverageClass= getCoverageClass( data ); | ||
fs.writeSync(out, "<h2>" + filename + "</h2>\n"); | ||
fs.writeSync(out, '<span class="coverage">' + "[ hits: " + data.hits); | ||
fs.writeSync(out, '<span class="coverage '+ coverageClass+'">' + "[ hits: " + data.hits); | ||
fs.writeSync(out, ", misses: " + data.misses + ", sloc: " + data.sloc); | ||
fs.writeSync(out, ", coverage: " + data.coverage.toFixed(2) + "% ]" + "</span>\n"); | ||
fs.writeSync(out, "<ol>\n"); | ||
fs.writeSync(out, ", coverage: " + data.coverage.toFixed(2) + "% ]" + "</span> <a href='#' onclick='expando(this)'>[+]</a>\n"); | ||
fs.writeSync(out, "<ol class='collapsed'>\n"); | ||
@@ -41,2 +50,3 @@ for (var i = 0; i < data.source.length; i++) { | ||
fs.writeSync(out, "</ol>\n"); | ||
fs.writeSync(out, "<hr/>\n"); | ||
} | ||
@@ -43,0 +53,0 @@ } |
@@ -1,8 +0,4 @@ | ||
var sys = require('sys'); | ||
var options = {}; | ||
var console = require('../../vows/console'); | ||
var spec = require('./spec'); | ||
var stylize = console.stylize, | ||
var options = { tail: '' }, | ||
console = require('../../vows/console'), | ||
stylize = console.stylize, | ||
puts = console.puts(options); | ||
@@ -12,5 +8,9 @@ // | ||
// | ||
var stream, messages = [], lastContext; | ||
var messages = [], lastContext; | ||
this.name = 'dot-matrix'; | ||
this.setStream = function (s) { | ||
options.stream = s; | ||
}; | ||
this.reset = function () { | ||
@@ -20,7 +20,5 @@ messages = []; | ||
}; | ||
this.report = function (data, s) { | ||
this.report = function (data) { | ||
var event = data[1]; | ||
options.stream = typeof(s) === 'object' ? s : process.stdout; | ||
switch (data[0]) { | ||
@@ -34,16 +32,16 @@ case 'subject': | ||
if (event.status === 'honored') { | ||
sys.print(stylize('·', 'green')); | ||
puts(stylize('·', 'green')); | ||
} else if (event.status === 'pending') { | ||
sys.print(stylize('-', 'cyan')); | ||
puts(stylize('-', 'cyan')); | ||
} else { | ||
if (lastContext !== event.context) { | ||
lastContext = event.context; | ||
messages.push(spec.contextText(event.context)); | ||
messages.push(' ' + event.context); | ||
} | ||
if (event.status === 'broken') { | ||
sys.print(stylize('✗', 'yellow')); | ||
messages.push(spec.vowText(event)); | ||
puts(stylize('✗', 'yellow')); | ||
messages.push(console.vowText(event)); | ||
} else if (event.status === 'errored') { | ||
sys.print(stylize('✗', 'red')); | ||
messages.push(spec.vowText(event)); | ||
puts(stylize('✗', 'red')); | ||
messages.push(console.vowText(event)); | ||
} | ||
@@ -54,3 +52,3 @@ messages.push(''); | ||
case 'end': | ||
sys.print(' '); | ||
puts(' '); | ||
break; | ||
@@ -61,3 +59,3 @@ case 'finish': | ||
} else { | ||
sys.print('\n'); | ||
puts(''); | ||
} | ||
@@ -73,3 +71,3 @@ puts(console.result(event).join('\n')); | ||
this.print = function (str) { | ||
sys.print(str); | ||
puts(str); | ||
}; |
@@ -1,2 +0,5 @@ | ||
var sys = require('sys'); | ||
var options = { tail: '\n', raw: true }; | ||
var console = require('../../vows/console'); | ||
var puts = console.puts(options); | ||
// | ||
@@ -6,6 +9,9 @@ // Console JSON reporter | ||
this.name = 'json'; | ||
this.setStream = function (s) { | ||
options.stream = s; | ||
}; | ||
this.report = function (obj) { | ||
sys.puts(JSON.stringify(obj)); | ||
puts(JSON.stringify(obj)); | ||
}; | ||
this.print = function (str) {}; |
var sys = require('sys'); | ||
var options = {}; | ||
var options = { tail: '\n' }; | ||
var console = require('../../vows/console'); | ||
@@ -12,6 +12,8 @@ var stylize = console.stylize, | ||
this.name = 'spec'; | ||
this.report = function (data, s) { | ||
this.setStream = function (s) { | ||
options.stream = s; | ||
}; | ||
this.report = function (data) { | ||
var event = data[1]; | ||
options.stream = typeof(s) === 'object' ? s : process.stdout; | ||
buffer = []; | ||
@@ -24,6 +26,6 @@ | ||
case 'context': | ||
puts(this.contextText(event)); | ||
puts(console.contextText(event)); | ||
break; | ||
case 'vow': | ||
puts(this.vowText(event)); | ||
puts(console.vowText(event)); | ||
break; | ||
@@ -42,36 +44,4 @@ case 'end': | ||
this.contextText = function (event) { | ||
return ' ' + event; | ||
}; | ||
this.vowText = function (event) { | ||
var buffer = []; | ||
buffer.push(' ' + { | ||
honored: ' ✓ ', | ||
broken: ' ✗ ', | ||
errored: ' ✗ ', | ||
pending: ' - ' | ||
}[event.status] + stylize(event.title, ({ | ||
honored: 'green', | ||
broken: 'yellow', | ||
errored: 'red', | ||
pending: 'cyan' | ||
})[event.status])); | ||
if (event.status === 'broken') { | ||
buffer.push(' » ' + event.exception); | ||
} else if (event.status === 'errored') { | ||
if (event.exception.type === 'promise') { | ||
buffer.push(' » ' + stylize("An unexpected error was caught: " + | ||
stylize(event.exception.error, 'bold'), 'red')); | ||
} else { | ||
buffer.push(' ' + stylize(event.exception, 'red')); | ||
} | ||
} | ||
return buffer.join('\n'); | ||
}; | ||
this.print = function (str) { | ||
sys.print(str); | ||
}; |
@@ -14,2 +14,5 @@ var sys = require('sys'); | ||
this.name = 'watch'; | ||
this.setStream = function (s) { | ||
options.stream = s; | ||
}; | ||
this.reset = function () { | ||
@@ -21,4 +24,2 @@ lastContext = null; | ||
options.stream = process.stdout; | ||
switch (data[0]) { | ||
@@ -29,5 +30,5 @@ case 'vow': | ||
lastContext = event.context; | ||
puts(spec.contextText(event.context)); | ||
puts(console.contextText(event.context)); | ||
} | ||
puts(spec.vowText(event)); | ||
puts(console.vowText(event)); | ||
puts(''); | ||
@@ -34,0 +35,0 @@ } |
@@ -145,3 +145,3 @@ var events = require('events'), | ||
// we create it ourselves, and emit the value on the next tick. | ||
if (! (topic && topic.constructor === events.EventEmitter)) { | ||
if (! (topic instanceof events.EventEmitter)) { | ||
ctx.emitter = new(events.EventEmitter); | ||
@@ -148,0 +148,0 @@ |
@@ -7,3 +7,3 @@ { | ||
"author" : "Alexis Sellier <self@cloudhead.net>", | ||
"contributors" : [], | ||
"contributors" : [{ "name": "Charlie Robbins", "email": "charlie.robbins@gmail.com" }], | ||
"dependencies" : {"eyes": ">=0.1.6"}, | ||
@@ -13,4 +13,4 @@ "main" : "./lib/vows", | ||
"directories" : { "test": "./test", "bin": "./bin" }, | ||
"version" : "0.5.9", | ||
"version" : "0.5.10", | ||
"engines" : {"node": ">=0.2.6"} | ||
} |
@@ -353,2 +353,7 @@ var path = require('path'), | ||
}, | ||
'subcontext': { | ||
'nested': function (_, topic) { | ||
assert.isTrue(topic.flag); | ||
} | ||
}, | ||
teardown: function (topic) { | ||
@@ -355,0 +360,0 @@ topic.flag = false; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
90303
33
2015
1