summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranonym <anonym@riseup.net>2015-09-17 15:50:48 +0200
committeranonym <anonym@riseup.net>2015-09-17 15:50:48 +0200
commit90c25e5c0dff15ba94f7491923f761f61af05784 (patch)
treef1aec40736e8af1081681144ad4f91a02c057dc9
parent2d81e7d9c33be3116c79756360ab08adb1ab4b16 (diff)
Add the 'plain_debug' formatter.test/10213-plain_debug-formatter
That is, the 'debug' formatter without colors. Will-fix: #10213
-rw-r--r--features/support/extra_hooks.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/features/support/extra_hooks.rb b/features/support/extra_hooks.rb
index a3422fc..58cf59f 100644
--- a/features/support/extra_hooks.rb
+++ b/features/support/extra_hooks.rb
@@ -50,6 +50,7 @@ def debug_log(message)
$debug_log_fns.each { |fn| fn.call(message) } if $debug_log_fns
end
+require 'cucumber/formatter/ansicolor'
require 'cucumber/formatter/pretty'
module ExtraFormatters
# This is a null formatter in the sense that it doesn't ever output
@@ -90,6 +91,21 @@ module ExtraFormatters
end
end
+ # The pretty formatter with debug logging mixed into its output and
+ # without color.
+ class PlainDebug < PrettyDebug
+ self.class_eval do
+ instance_methods.each do |method_name|
+ define_method method_name do |*args|
+ orig = Cucumber::Term::ANSIColor.coloring?
+ Cucumber::Term::ANSIColor.coloring = false
+ r = super(*args)
+ Cucumber::Term::ANSIColor.coloring = orig
+ return r
+ end
+ end
+ end
+ end
end
module Cucumber
@@ -101,6 +117,11 @@ module Cucumber
'Prints the feature with debugging information - in colours.'
]
BUILTIN_FORMATS['debug'] = BUILTIN_FORMATS['pretty_debug']
+ BUILTIN_FORMATS['plain_debug'] =
+ [
+ 'ExtraFormatters::PlainDebug',
+ 'Prints the feature with debugging information - without colours.'
+ ]
end
end
end