fix a few verbose reporter bugs

This commit is contained in:
John Bintz 2012-01-12 16:47:36 -05:00
parent 5d43eb2193
commit 09842c0539
4 changed files with 33 additions and 19 deletions

View File

@ -150,6 +150,8 @@ module Jasmine
sleep 0.1 sleep 0.1
end end
Jasmine::Headless.warn "HTTP powered specs!"
yield yield
Thread.kill(server) Thread.kill(server)

View File

@ -80,15 +80,18 @@ if window.JHW
puts msg puts msg
JHW.createCoffeeScriptFileException = (e) -> JHW.createCoffeeScriptFileException = (e) ->
if e and e.sourceURL and window.CoffeeScriptToFilename if e and e.sourceURL
filename = e.sourceURL.split('/').pop() filename = e.sourceURL.split('/').pop()
if realFilename = window.CoffeeScriptToFilename[filename]
e = { e =
name: e.name, name: e.name
message: e.message, message: e.message
lineNumber: "~" + String(e.line), sourceURL: e.sourceURL
sourceURL: realFilename lineNumber: e.line
}
if window.CoffeeScriptToFilename and realFilename = window.CoffeeScriptToFilename[filename]
e.sourceURL = realFilename
e.lineNumber = "~" + String(e.line)
e e

View File

@ -1,6 +1,8 @@
#= require jasmine.HeadlessReporter.ConsoleBase #= require jasmine.HeadlessReporter.ConsoleBase
# #
class jasmine.HeadlessReporter.Verbose extends jasmine.HeadlessReporter.ConsoleBase class jasmine.HeadlessReporter.Verbose extends jasmine.HeadlessReporter.ConsoleBase
@prereport = false
displaySuccess: (spec) => displaySuccess: (spec) =>
this.displaySpec(spec, 'green') this.displaySpec(spec, 'green')
@ -46,12 +48,17 @@ class jasmine.HeadlessReporter.Verbose extends jasmine.HeadlessReporter.ConsoleB
colorLine: (line, color) => colorLine: (line, color) =>
line.foreground(color) line.foreground(color)
reportSpecStarting: (spec) =>
if jasmine.HeadlessReporter.Verbose.prereport
this.puts(spec.getSpecSplitName().join(' '))
reportException: (e) => reportException: (e) =>
e = JHW.createCoffeeScriptFileException(e) e = JHW.createCoffeeScriptFileException(e)
output = e.message
if e.sourceURL && e.lineNumber if e.sourceURL && e.lineNumber
output = "#{e.sourceURL}:~#{e.lineNumber} #{output}" output = "#{e.sourceURL}:#{e.lineNumber} #{e.message}"
else
output = e.message ? e
this.puts(output.foreground('yellow')) this.puts(output.foreground('yellow'))

View File

@ -84,15 +84,17 @@
}; };
JHW.createCoffeeScriptFileException = function(e) { JHW.createCoffeeScriptFileException = function(e) {
var filename, realFilename; var filename, realFilename;
if (e && e.sourceURL && window.CoffeeScriptToFilename) { if (e && e.sourceURL) {
filename = e.sourceURL.split('/').pop(); filename = e.sourceURL.split('/').pop();
if (realFilename = window.CoffeeScriptToFilename[filename]) {
e = { e = {
name: e.name, name: e.name,
message: e.message, message: e.message,
lineNumber: "~" + String(e.line), sourceURL: e.sourceURL,
sourceURL: realFilename lineNumber: e.line
}; };
if (window.CoffeeScriptToFilename && (realFilename = window.CoffeeScriptToFilename[filename])) {
e.sourceURL = realFilename;
e.lineNumber = "~" + String(e.line);
} }
} }
return e; return e;