a few more tweaks for things
This commit is contained in:
parent
be5c7f25cd
commit
2be2edb910
@ -21,7 +21,7 @@ module Flowerbox
|
|||||||
require 'flowerbox/rails/engine'
|
require 'flowerbox/rails/engine'
|
||||||
end
|
end
|
||||||
|
|
||||||
CACHE_DIR = '.tmp-sprockets'
|
CACHE_DIR = 'tmp/sprockets'
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
attr_writer :reporters
|
attr_writer :reporters
|
||||||
@ -115,6 +115,10 @@ module Flowerbox
|
|||||||
break if env.transplant(dir)
|
break if env.transplant(dir)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def cache_dir
|
||||||
|
File.join(CACHE_DIR, Flowerbox.test_environment.name)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ module Flowerbox::Reporter
|
|||||||
puts result.name.join(" - ").foreground(:red)
|
puts result.name.join(" - ").foreground(:red)
|
||||||
result.failures.each do |failure|
|
result.failures.each do |failure|
|
||||||
puts " " + failure.message.foreground(:red) + " [" + failure.runners.join(',') + "] " + path_for(failure)
|
puts " " + failure.message.foreground(:red) + " [" + failure.runners.join(',') + "] " + path_for(failure)
|
||||||
puts failure.stack.join("\n").foreground(:red) if failure.exception?
|
puts failure.filtered_stack.join("\n").foreground(:red) if failure.exception?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -12,6 +12,8 @@ module Flowerbox::Reporter
|
|||||||
if result.name
|
if result.name
|
||||||
result.name.each_with_index do |name, index|
|
result.name.each_with_index do |name, index|
|
||||||
if @name_stack[index] != name
|
if @name_stack[index] != name
|
||||||
|
@name_stack = []
|
||||||
|
|
||||||
if name != result.name.last
|
if name != result.name.last
|
||||||
message = name
|
message = name
|
||||||
else
|
else
|
||||||
|
@ -34,6 +34,14 @@ module Flowerbox::Result
|
|||||||
@data['stack'] || []
|
@data['stack'] || []
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def filtered_stack
|
||||||
|
stack.collect do |line|
|
||||||
|
line.gsub(%r{\.coffee:(\d+)}) do |_|
|
||||||
|
".coffee:~#{($1.to_i * 0.67 + 1).to_i}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def first_local_stack
|
def first_local_stack
|
||||||
@first_local_stack ||= stack[1..-1].find do |line|
|
@first_local_stack ||= stack[1..-1].find do |line|
|
||||||
!system_files.any? { |file| line[%r{\(#{file}}] }
|
!system_files.any? { |file| line[%r{\(#{file}}] }
|
||||||
|
@ -57,8 +57,21 @@ module Flowerbox
|
|||||||
|
|
||||||
puts "Flowerbox running your #{Flowerbox.test_environment.name} tests on #{console_name}..."
|
puts "Flowerbox running your #{Flowerbox.test_environment.name} tests on #{console_name}..."
|
||||||
|
|
||||||
|
attempts = 3
|
||||||
|
|
||||||
|
while true
|
||||||
|
begin
|
||||||
server.start
|
server.start
|
||||||
|
|
||||||
|
break
|
||||||
|
rescue Flowerbox::Server::ServerDiedError
|
||||||
|
attempts -= 1
|
||||||
|
raise RunnerDiedError.new if attempts == 0
|
||||||
|
|
||||||
|
Flowerbox.server = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
yield
|
yield
|
||||||
|
|
||||||
server.stop
|
server.stop
|
||||||
|
@ -8,6 +8,8 @@ module Flowerbox
|
|||||||
class Server
|
class Server
|
||||||
attr_reader :options
|
attr_reader :options
|
||||||
|
|
||||||
|
class ServerDiedError < StandardError ; end
|
||||||
|
|
||||||
def initialize(options = {})
|
def initialize(options = {})
|
||||||
@options = { :logging => false }.merge(options || {})
|
@options = { :logging => false }.merge(options || {})
|
||||||
end
|
end
|
||||||
@ -39,7 +41,7 @@ module Flowerbox
|
|||||||
sleep 0.1
|
sleep 0.1
|
||||||
end
|
end
|
||||||
|
|
||||||
raise StandardError.new("Server died") if !@server_thread[:server].running?
|
raise ServerDiedError.new if !@server_thread[:server].running?
|
||||||
end
|
end
|
||||||
|
|
||||||
def stop
|
def stop
|
||||||
|
@ -39,7 +39,7 @@ module Flowerbox
|
|||||||
return @environment if @environment
|
return @environment if @environment
|
||||||
|
|
||||||
@environment = Sprockets::Environment.new
|
@environment = Sprockets::Environment.new
|
||||||
@environment.cache = Sprockets::Cache::FileStore.new(Flowerbox::CACHE_DIR)
|
@environment.cache = Sprockets::Cache::FileStore.new(Flowerbox.cache_dir)
|
||||||
|
|
||||||
self.class.gem_asset_paths.each { |path| append_path(path) }
|
self.class.gem_asset_paths.each { |path| append_path(path) }
|
||||||
options[:asset_paths].each { |path| append_path(path) }
|
options[:asset_paths].each { |path| append_path(path) }
|
||||||
|
Loading…
Reference in New Issue
Block a user