From 09842c0539a64acee9bebae64e59e431bdaeac25 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Thu, 12 Jan 2012 16:47:36 -0500 Subject: [PATCH] fix a few verbose reporter bugs --- lib/jasmine/headless/runner.rb | 2 ++ vendor/assets/coffeescripts/prolog.coffee | 19 +++++++++++-------- .../jasmine.HeadlessReporter.Verbose.coffee | 13 ++++++++++--- vendor/assets/javascripts/prolog.js | 18 ++++++++++-------- 4 files changed, 33 insertions(+), 19 deletions(-) diff --git a/lib/jasmine/headless/runner.rb b/lib/jasmine/headless/runner.rb index 558c907..4f3245e 100644 --- a/lib/jasmine/headless/runner.rb +++ b/lib/jasmine/headless/runner.rb @@ -150,6 +150,8 @@ module Jasmine sleep 0.1 end + Jasmine::Headless.warn "HTTP powered specs!" + yield Thread.kill(server) diff --git a/vendor/assets/coffeescripts/prolog.coffee b/vendor/assets/coffeescripts/prolog.coffee index 078be7c..a1fcd2e 100644 --- a/vendor/assets/coffeescripts/prolog.coffee +++ b/vendor/assets/coffeescripts/prolog.coffee @@ -80,15 +80,18 @@ if window.JHW puts msg JHW.createCoffeeScriptFileException = (e) -> - if e and e.sourceURL and window.CoffeeScriptToFilename + if e and e.sourceURL filename = e.sourceURL.split('/').pop() - if realFilename = window.CoffeeScriptToFilename[filename] - e = { - name: e.name, - message: e.message, - lineNumber: "~" + String(e.line), - sourceURL: realFilename - } + + e = + name: e.name + message: e.message + sourceURL: e.sourceURL + lineNumber: e.line + + if window.CoffeeScriptToFilename and realFilename = window.CoffeeScriptToFilename[filename] + e.sourceURL = realFilename + e.lineNumber = "~" + String(e.line) e diff --git a/vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.coffee b/vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.coffee index 1d1d0b0..591796f 100644 --- a/vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.coffee +++ b/vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.coffee @@ -1,6 +1,8 @@ #= require jasmine.HeadlessReporter.ConsoleBase # class jasmine.HeadlessReporter.Verbose extends jasmine.HeadlessReporter.ConsoleBase + @prereport = false + displaySuccess: (spec) => this.displaySpec(spec, 'green') @@ -46,12 +48,17 @@ class jasmine.HeadlessReporter.Verbose extends jasmine.HeadlessReporter.ConsoleB colorLine: (line, color) => line.foreground(color) + reportSpecStarting: (spec) => + if jasmine.HeadlessReporter.Verbose.prereport + this.puts(spec.getSpecSplitName().join(' ')) + reportException: (e) => e = JHW.createCoffeeScriptFileException(e) - - output = e.message + 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')) diff --git a/vendor/assets/javascripts/prolog.js b/vendor/assets/javascripts/prolog.js index 3ada0bb..e977e42 100644 --- a/vendor/assets/javascripts/prolog.js +++ b/vendor/assets/javascripts/prolog.js @@ -84,15 +84,17 @@ }; JHW.createCoffeeScriptFileException = function(e) { var filename, realFilename; - if (e && e.sourceURL && window.CoffeeScriptToFilename) { + if (e && e.sourceURL) { filename = e.sourceURL.split('/').pop(); - if (realFilename = window.CoffeeScriptToFilename[filename]) { - e = { - name: e.name, - message: e.message, - lineNumber: "~" + String(e.line), - sourceURL: realFilename - }; + e = { + name: e.name, + message: e.message, + sourceURL: e.sourceURL, + lineNumber: e.line + }; + if (window.CoffeeScriptToFilename && (realFilename = window.CoffeeScriptToFilename[filename])) { + e.sourceURL = realFilename; + e.lineNumber = "~" + String(e.line); } } return e;