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