a bunch of fixes for printing file names
This commit is contained in:
parent
2cb9e44629
commit
f070f042f2
@ -39,20 +39,6 @@ Flowerbox.World ->
|
||||
Flowerbox.Matcher.matchers = {}
|
||||
@addMatchers(Flowerbox.Matchers)
|
||||
|
||||
if Flowerbox.Cucumber.tags
|
||||
negatedTags = []
|
||||
for tagSet in Flowerbox.Cucumber.tags
|
||||
tags = for tag in tagSet.split(',')
|
||||
if tag.substr(0, 1) == '@'
|
||||
"~" + tag
|
||||
else
|
||||
tag.substr(1)
|
||||
|
||||
negatedTags.push(tags)
|
||||
|
||||
@around (negatedTags..., runScenario) ->
|
||||
|
||||
|
||||
class Flowerbox.Matcher
|
||||
@addMatchers: (data) ->
|
||||
for method, code of data
|
||||
@ -106,16 +92,21 @@ Flowerbox.Step.matchFile = (name) ->
|
||||
stepGenerator = (type) ->
|
||||
Flowerbox[type] = (match, code) ->
|
||||
if !Flowerbox.Step.files[match.toString()]
|
||||
count = 2
|
||||
nextLine = false
|
||||
if stack = (new Error()).stack
|
||||
for line in stack.split('\n')
|
||||
if line.match(/__F__/)
|
||||
count -= 1
|
||||
if nextLine
|
||||
result = if line.match(/__F__/)
|
||||
line.replace(/^.*__F__\/([^:]+:\d+).*$/, '$1')
|
||||
else
|
||||
line.replace(/^.*(\(| )([^:]+:\d+).*$/, '$2')
|
||||
|
||||
if count == 0
|
||||
Flowerbox.Step.files[match.toString()] = [ match, line.replace(/^.*__F__/, '') ]
|
||||
Flowerbox.Step.files[match.toString()] = [ match, result ]
|
||||
break
|
||||
|
||||
if line.match(/(Given|When|Then)/)
|
||||
nextLine = true
|
||||
|
||||
Flowerbox.Step(type, match, code)
|
||||
|
||||
stepGenerator(type) for type in [ 'Given', 'When', 'Then' ]
|
||||
|
@ -1,12 +1,5 @@
|
||||
jasmine.Spec.beforeAddMatcherResult().push ->
|
||||
if !@passed_
|
||||
Error.prepareStackTrace_ = Error.prepareStackTrace
|
||||
Error.prepareStackTrace = (err, stack) -> stack
|
||||
|
||||
errorInfo = new Error().stack[3]
|
||||
|
||||
@trace = { stack: "#{errorInfo.getFileName()}:#{errorInfo.getLineNumber()}" }
|
||||
|
||||
Error.prepareStackTrace = Error.prepareStackTrace_
|
||||
@trace = { stack: new Error().stack }
|
||||
|
||||
Flowerbox.fail = -> process.exit(1)
|
||||
|
@ -13,7 +13,7 @@ module Flowerbox::Result
|
||||
end
|
||||
|
||||
def file
|
||||
first_local_stack[%r{__F__/(.*)$}, 1]
|
||||
first_local_stack[%r{\(([^:]+\:\d+)}, 1]
|
||||
end
|
||||
|
||||
def runner
|
||||
@ -25,7 +25,9 @@ module Flowerbox::Result
|
||||
end
|
||||
|
||||
def first_local_stack
|
||||
@data['stack'].find { |line| line['__F__'] } || @data['stack'][1]
|
||||
@data['stack'][1..-1].find do |line|
|
||||
!system_files.any? { |file| line[%r{\(#{file}}] }
|
||||
end || @data['stack'][1]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -28,5 +28,9 @@ module Flowerbox::Result::FileInfo
|
||||
def translated_file_and_line
|
||||
"#{translated_file.gsub(%r{^/}, '')}:#{line_number}"
|
||||
end
|
||||
|
||||
def system_files
|
||||
Flowerbox.test_environment.system_files
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -28,11 +28,12 @@ module Flowerbox::Run
|
||||
Flowerbox.run_with(runners.split(','))
|
||||
end
|
||||
|
||||
Flowerbox.test_environment.run = self
|
||||
Flowerbox.test_environment.set_additional_options(options[:env_options])
|
||||
end
|
||||
|
||||
def sprockets
|
||||
sprockets = Flowerbox::Delivery::SprocketsHandler.new(
|
||||
Flowerbox::Delivery::SprocketsHandler.new(
|
||||
:asset_paths => [
|
||||
Flowerbox.path.join("lib/assets/javascripts"),
|
||||
Flowerbox.path.join("vendor/assets/javascripts"),
|
||||
@ -40,15 +41,6 @@ module Flowerbox::Run
|
||||
Flowerbox.asset_paths
|
||||
].flatten
|
||||
)
|
||||
|
||||
sprockets.add('flowerbox')
|
||||
sprockets.add('json2')
|
||||
|
||||
Flowerbox.test_environment.inject_into(sprockets)
|
||||
|
||||
Flowerbox.additional_files.each { |file| sprockets.add(file) }
|
||||
|
||||
sprockets
|
||||
end
|
||||
|
||||
def spec_files
|
||||
@ -74,6 +66,10 @@ module Flowerbox::Run
|
||||
@only = nil if only.empty?
|
||||
@only
|
||||
end
|
||||
|
||||
def system_files
|
||||
%w{flowerbox json2}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -20,6 +20,10 @@ module Flowerbox
|
||||
|
||||
def setup(sprockets, spec_files, options)
|
||||
@sprockets, @spec_files, @options = sprockets, spec_files, options
|
||||
|
||||
Flowerbox.test_environment.runner = self
|
||||
Flowerbox.test_environment.inject_into(sprockets)
|
||||
Flowerbox.additional_files.each { |file| sprockets.add(file) }
|
||||
end
|
||||
|
||||
def run(*args)
|
||||
@ -61,7 +65,7 @@ module Flowerbox
|
||||
end
|
||||
|
||||
def start_test_environment
|
||||
Flowerbox.test_environment.start_for(self)
|
||||
Flowerbox.test_environment.start
|
||||
end
|
||||
|
||||
def time=(time)
|
||||
|
@ -107,6 +107,12 @@ jsdom.env(
|
||||
request.end();
|
||||
} else {
|
||||
#{env}
|
||||
|
||||
var waitForFinish;
|
||||
waitForFinish = function() {
|
||||
if (context.Flowerbox.working) { process.nextTick(waitForFinish); }
|
||||
};
|
||||
waitForFinish();
|
||||
}
|
||||
};
|
||||
fileRunner();
|
||||
|
@ -3,6 +3,8 @@ require 'yaml'
|
||||
module Flowerbox
|
||||
module TestEnvironment
|
||||
class Base
|
||||
attr_accessor :runner, :run
|
||||
|
||||
def name
|
||||
self.class.name.split("::").last
|
||||
end
|
||||
@ -25,6 +27,20 @@ module Flowerbox
|
||||
@options[:tags] = [ @options[:tags] ].flatten(1) if @options[:tags]
|
||||
end
|
||||
end
|
||||
|
||||
def inject_into(sprockets)
|
||||
@sprockets = sprockets
|
||||
|
||||
system_files.each { |file| @sprockets.add(file) }
|
||||
end
|
||||
|
||||
def system_files
|
||||
run.system_files + global_system_files + runner_system_files
|
||||
end
|
||||
|
||||
def start
|
||||
runner.spec_files.each { |file| @sprockets.add(file) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -10,20 +10,21 @@ module Flowerbox
|
||||
end
|
||||
|
||||
def inject_into(sprockets)
|
||||
@sprockets = sprockets
|
||||
super
|
||||
|
||||
@sprockets.register_engine('.feature', Flowerbox::Delivery::Tilt::FeatureTemplate)
|
||||
|
||||
@sprockets.add('cucumber.js')
|
||||
end
|
||||
|
||||
def start_for(runner)
|
||||
@runner = runner
|
||||
def global_system_files
|
||||
%w{cucumber.js flowerbox/cucumber}
|
||||
end
|
||||
|
||||
@sprockets.add("flowerbox/cucumber")
|
||||
@sprockets.add("flowerbox/cucumber/#{runner.type}")
|
||||
def runner_system_files
|
||||
[ "flowerbox/cucumber/#{@runner.type}" ]
|
||||
end
|
||||
|
||||
@runner.spec_files.each { |file| @sprockets.add(file) }
|
||||
def start
|
||||
super
|
||||
|
||||
<<-JS
|
||||
context.Cucumber = context.require('./cucumber');
|
||||
|
@ -3,21 +3,22 @@ require 'jasmine-core'
|
||||
module Flowerbox
|
||||
module TestEnvironment
|
||||
class Jasmine < Base
|
||||
|
||||
def inject_into(sprockets)
|
||||
@sprockets = sprockets
|
||||
sprockets.append_path(::Jasmine::Core.path)
|
||||
|
||||
@sprockets.append_path(::Jasmine::Core.path)
|
||||
|
||||
@sprockets.add('jasmine.js')
|
||||
@sprockets.add('jasmine-html.js')
|
||||
super
|
||||
end
|
||||
|
||||
def start_for(runner)
|
||||
@sprockets.add("flowerbox/jasmine.js")
|
||||
@sprockets.add("flowerbox/jasmine/#{runner.type}.js")
|
||||
def global_system_files
|
||||
%w{jasmine.js flowerbox/jasmine.js}
|
||||
end
|
||||
|
||||
runner.spec_files.each { |file| @sprockets.add(file) }
|
||||
def runner_system_files
|
||||
[ "flowerbox/jasmine/#{@runner.type}.js" ]
|
||||
end
|
||||
|
||||
def start
|
||||
super
|
||||
|
||||
<<-JS
|
||||
if (typeof context != 'undefined' && typeof jasmine == 'undefined') {
|
||||
|
Loading…
Reference in New Issue
Block a user