a bunch of other changes

This commit is contained in:
John Bintz 2012-03-17 11:08:33 -04:00
parent be7fb0237b
commit f6cef98b39
13 changed files with 54 additions and 25 deletions

View File

@ -21,7 +21,7 @@ Flowerbox =
onQueueStateChange: ->
queueRunner: ->
queueRunner: (failsafe = 5) ->
Flowerbox.onQueueStateChange("checking queue")
if Flowerbox.contactQueue.length > 0
Flowerbox.started = true
@ -55,7 +55,10 @@ Flowerbox =
xhr.abort()
Flowerbox.onQueueStateChange("aborted #{url}, rerunning")
Flowerbox.contactQueue.unshift(info)
Flowerbox.queueRunner()
if failsafe > 0
failsafe -= 1
Flowerbox.queueRunner(failsafe)
, Flowerbox.delay * 5
)

View File

@ -17,16 +17,22 @@ Flowerbox.World = (code = null) ->
Flowerbox.Matchers =
toEqual: (expected) ->
@message = "Expected #{@actual} #{@notMessage} equal #{expected}"
if typeof @actual == 'object'
for key, value of @actual
return false if expected[key] != value
result = null
for key, value of expected
return false if @actual[key] != value
if @actual? && expected?
switch (typeof @actual)
when 'object'
result = true
for key, value of @actual
result = false if expected[key] != value
true
else
@actual == expected
for key, value of expected
result = false if @actual[key] != value
if result == null
result = (@actual == expected)
result
Flowerbox.World ->
@assert = (what, message = 'failed') ->

View File

@ -39,7 +39,7 @@ class Flowerbox.Cucumber.Reporter
when 'StepResult'
stepResult = event.getPayloadItem('stepResult')
file = Flowerbox.Step.matchFile(@step.getName()) || "unknown:0"
file = Flowerbox.Step.matchFile(@step.getName()) || "#{Flowerbox.UNKNOWN}:0"
result = new Flowerbox.Result(step_type: this.type(), source: 'cucumber', original_name: @step.getName(), name: this.nameParts(), file: file)

View File

@ -4,7 +4,7 @@ class jasmine.FlowerboxReporter
status: Flowerbox.Result.SUCCESS
source: 'jasmine'
name: spec.getSpecSplitName()
file: 'unknown:0'
file: "#{Flowerbox.UNKNOWN}:0"
for key, value of overrides
data[key] = value

View File

@ -11,7 +11,7 @@ jasmine.Spec.beforeAddMatcherResult().push ->
when 'chrome'
e.stack.split("\n")[4]
else
'unknown:0'
"#{Flowerbox.UNKNOWN}:0"
@trace = { stack: [ @message, file ] }

View File

@ -75,12 +75,6 @@ module Flowerbox
runner.template
end
class << self
private
def setup_protetion(builder)
end
end
end
end

View File

@ -1,28 +1,38 @@
module Flowerbox::Result::FileInfo
UNKNOWN = '__unknown__'
def translated_file
@translated_file ||= filename
return @translated_file if @translated_file
if filename == UNKNOWN
@translated_file = UNKNOWN
else
@translated_file = Flowerbox.test_environment.actual_path_for(filename)
end
@translated_file
end
def file_translated?
translated_file != filename
translated_file[%r{\.coffee$}]
end
def filename
file.to_s.split(":").first || 'unknown'
file.to_s.split(":").first || UNKNOWN
end
def line_number
return @line_number if @line_number
@line_number = file.to_s.split(":")[1]
@line_number = "~#{@line_number}" if file_translated?
@line_number = "~#{(@line_number.to_i * 0.67).to_i}" if file_translated?
@line_number ||= "0"
end
alias :line :line_number
def translated_file_and_line
"#{translated_file.gsub(%r{^/}, '')}:#{line_number}"
"#{translated_file.gsub(%r{^#{Dir.pwd}/}, '')}:#{line_number}"
end
def system_files

View File

@ -41,7 +41,13 @@ module Flowerbox
end
def exitstatus
results.any?(&:failure?) ? 1 : 0
if results.any?(&:failure?)
1
elsif results.any?(&:pending?)
2
else
0
end
end
def print(data = {})

View File

@ -33,6 +33,9 @@ module Flowerbox
if !finished?
puts "Something died hard. Here are the tests that did get run before Flowerbox died.".foreground(:red)
puts tests.flatten.join("\n").foreground(:red)
server.stop
Flowerbox.server = nil
raise RunnerDiedError.new
end
end

View File

@ -1,6 +1,7 @@
require 'flowerbox/runner/selenium'
class Flowerbox::Runner::Chrome < Flowerbox::Runner::Selenium
def name
"Chrome"
end

View File

@ -95,6 +95,7 @@ jsdom.env(
if (!gotFlowerbox && context.Flowerbox) {
context.Flowerbox.baseUrl = "http://localhost:#{server.port}/";
context.Flowerbox.environment = 'node';
context.Flowerbox.UNKNOWN = '#{Flowerbox::Result::FileInfo::UNKNOWN}';
gotFlowerbox = true;
}

View File

@ -56,6 +56,7 @@ console.log = function(msg) {
Flowerbox.onQueueStateChange = function(msg) {
//document.getElementById('queue').innerHTML = document.getElementById('queue').innerHTML + "\\n" + msg;
};
Flowerbox.UNKNOWN = '#{Flowerbox::Result::FileInfo::UNKNOWN}';
var context = this;

View File

@ -41,6 +41,10 @@ module Flowerbox
def start
runner.spec_files.each { |file| @sprockets.add(file) }
end
def actual_path_for(file)
@sprockets.asset_for(file, :bundle => false).pathname.to_s
end
end
end
end