21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
# File 'lib/teabag/command_line.rb', line 21
def opt_parser
OptionParser.new do |parser|
parser.banner = "Usage: teabag [options] [files]\n\n"
parser.on("-r", "--require FILE", "Require Teabag environment file.") do |file|
@options[:environment] = file
end
parser.on("-d", "--driver DRIVER", "Specify driver:",
" phantomjs (default)",
" selenium") do |driver|
@options[:driver] = driver
end
parser.on("--server SERVER", "Sets server to use with Rack.") do |server|
@options[:server] = server
end
parser.on("--server-timeout SECONDS", "Sets the timeout for the server to start.") do |seconds|
@options[:server_timeout] = seconds
end
parser.on("--server-port PORT", "Sets the server to use a specific port.") do |port|
@options[:server_port] = port
end
parser.on("--[no-]fail-fast", "Abort after the first failing suite.") do |bool|
@options[:fail_fast] = bool
end
parser.separator("\n **** Filtering ****\n\n")
parser.on("-s", "--suite SUITE", "Focus to a specific suite.") do |suite|
@options[:suite] = suite
end
parser.on("-g", "--filter FILTER", "Filter tests matching a specific filter.") do |filter|
@options[:filter] = filter
end
parser.separator("\n **** Output ****\n\n")
parser.on("-f", "--format FORMATTERS", "Specify formatters (comma separated)",
" dot (default) - dots",
" tap_y - format used by tapout",
" swayze_or_oprah - random quote from Patrick Swayze or Oprah Winfrey") do |formatters|
@options[:formatters] = formatters
end
parser.on("-q", "--[no-]suppress-log", "Suppress logs coming from console[log/debug/error].") do |bool|
@options[:suppress_log] = bool
end
parser.on("-c", "--[no-]colour", "Enable/Disable color output.") do |bool|
@options[:color] = bool
end
parser.separator("\n **** Coverage ****\n\n")
parser.on("-C", "--coverage", "Generate coverage report (requires Istanbul).") do |bool|
@options[:coverage] = bool
end
parser.on("-R", "--coverage-reports FORMATS", "Specify which coverage reports to generate (comma separated)",
" text-summary (default) - compact text summary in results",
" text - text table with coverage for all files in results",
" html - HTML files with annotated source code",
" lcov - html + lcov files",
" lcovonly - an lcov.info file",
" cobertura - cobertura-coverage.xml used by Hudson") do |reports|
@options[:coverage] = true
@options[:coverage_reports] = reports
end
parser.separator("\n **** Utility ****\n\n")
parser.on("-v", "--version", "Display the version.") do
puts Teabag::VERSION
exit
end
parser.on("-h", "--help", "You're looking at it.") do
puts parser
exit
end
end
end
|