tryouts 3.0.0.pre → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/exe/try +32 -0
- data/lib/tryouts/cli/formatters/compact.rb +30 -2
- data/lib/tryouts/cli/formatters/factory.rb +10 -2
- data/lib/tryouts/cli/formatters/quiet.rb +19 -3
- data/lib/tryouts/cli/formatters/verbose.rb +23 -19
- data/lib/tryouts/console.rb +3 -3
- data/lib/tryouts/test_executor.rb +1 -1
- data/lib/tryouts/version.rb +1 -1
- data/lib/tryouts.rb +1 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8f095071e066f97f3b04680aa28ca1cd98bfb2f40006937b08a59dd8d5fc04c
|
4
|
+
data.tar.gz: bb5b18a0d0b703fa07fd4aad746b9bac66765fa23929571152b8f047bf310887
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 633e4c03eb25ae604be0ea2d18d78f40917893182d9105e55f98ded0ee9f0d1c1505896976bd4d635ebd60ed69a297396db4e70fca28aa37b83e2610a110623b
|
7
|
+
data.tar.gz: 7ba9e3714720b3e5546a8f5962d553ed8f20a94e1ea46ca9da0650302fe4b399158cbd2765a404ab2735c7840417c0643c318ef008f1edf74ed3479d5201ebbc
|
data/README.md
CHANGED
@@ -48,15 +48,15 @@ bundle install
|
|
48
48
|
try
|
49
49
|
|
50
50
|
# Run specific test file
|
51
|
-
try try/
|
51
|
+
try try/proof1_try.rb
|
52
52
|
|
53
53
|
# Framework integration
|
54
|
-
try --rspec try/
|
55
|
-
try --minitest try/
|
54
|
+
try --rspec try/proof1_try.rb # Run with RSpec
|
55
|
+
try --minitest try/proof1_try.rb # Run with Minitest
|
56
56
|
|
57
57
|
# Code generation only
|
58
|
-
try --generate-rspec try/
|
59
|
-
try --generate-minitest try/
|
58
|
+
try --generate-rspec try/proof1_try.rb
|
59
|
+
try --generate-minitest try/proof1_try.rb
|
60
60
|
|
61
61
|
# Output options
|
62
62
|
try -v # verbose (includes source code and return values)
|
data/exe/try
CHANGED
@@ -1,5 +1,37 @@
|
|
1
1
|
#!/usr/bin/env /Users/d/.rbenv/shims/ruby
|
2
2
|
|
3
|
+
# Coverage tracking (must be first)
|
4
|
+
if ENV['COVERAGE'] || ENV['SIMPLECOV']
|
5
|
+
require 'simplecov'
|
6
|
+
# Reset any existing coverage data to prevent line count mismatches
|
7
|
+
Coverage.result(stop: false, clear: true) if defined?(Coverage)
|
8
|
+
SimpleCov.start do
|
9
|
+
track_files 'lib/**/*.rb'
|
10
|
+
add_filter '/try/'
|
11
|
+
add_filter '/test/'
|
12
|
+
add_filter '/test_'
|
13
|
+
add_filter '/spec/'
|
14
|
+
add_filter '/examples/'
|
15
|
+
add_filter '/docs/'
|
16
|
+
|
17
|
+
add_group 'Core', 'lib/tryouts.rb'
|
18
|
+
add_group 'CLI', 'lib/tryouts/cli'
|
19
|
+
add_group 'Formatters', 'lib/tryouts/cli/formatters'
|
20
|
+
add_group 'Parsers', 'lib/tryouts/prism_parser.rb'
|
21
|
+
add_group 'Data Structures', ['lib/tryouts/testcase.rb', 'lib/tryouts/testbatch.rb']
|
22
|
+
add_group 'Translators', 'lib/tryouts/translators'
|
23
|
+
add_group 'Execution', ['lib/tryouts/test_executor.rb', 'lib/tryouts/test_runner.rb', 'lib/tryouts/file_processor.rb']
|
24
|
+
|
25
|
+
coverage_dir 'coverage'
|
26
|
+
|
27
|
+
# Coverage thresholds disabled to prevent CI failures
|
28
|
+
# minimum_coverage 80
|
29
|
+
# minimum_coverage_by_file 70
|
30
|
+
end
|
31
|
+
|
32
|
+
SimpleCov.command_name 'Tryouts CLI'
|
33
|
+
end
|
34
|
+
|
3
35
|
require_relative '../lib/tryouts'
|
4
36
|
|
5
37
|
# Add development library paths
|
@@ -65,7 +65,15 @@ class Tryouts
|
|
65
65
|
detail << "#{error_count} errors"
|
66
66
|
end
|
67
67
|
|
68
|
-
time_str =
|
68
|
+
time_str = if elapsed_time
|
69
|
+
if elapsed_time < 2
|
70
|
+
" (#{(elapsed_time * 1000).to_i}ms)"
|
71
|
+
else
|
72
|
+
" (#{elapsed_time.round(2)}s)"
|
73
|
+
end
|
74
|
+
else
|
75
|
+
''
|
76
|
+
end
|
69
77
|
puts " #{status} #{detail.join(', ')}#{time_str}"
|
70
78
|
end
|
71
79
|
|
@@ -169,7 +177,13 @@ class Tryouts
|
|
169
177
|
result = Console.color(:green, "#{total_tests} tests passed")
|
170
178
|
end
|
171
179
|
|
172
|
-
|
180
|
+
time_str = if elapsed_time < 2
|
181
|
+
"#{(elapsed_time * 1000).to_i}ms"
|
182
|
+
else
|
183
|
+
"#{elapsed_time.round(2)}s"
|
184
|
+
end
|
185
|
+
|
186
|
+
puts "Total: #{result} (#{time_str})"
|
173
187
|
puts "Files: #{successful_files} of #{total_files} successful"
|
174
188
|
end
|
175
189
|
|
@@ -214,5 +228,19 @@ class Tryouts
|
|
214
228
|
end
|
215
229
|
end
|
216
230
|
end
|
231
|
+
|
232
|
+
# Compact formatter that only shows failures and errors
|
233
|
+
class CompactFailsFormatter < CompactFormatter
|
234
|
+
def initialize(options = {})
|
235
|
+
super(options.merge(show_passed: false))
|
236
|
+
end
|
237
|
+
|
238
|
+
def test_result(test_case, result_status, actual_results = [], elapsed_time = nil)
|
239
|
+
# Only show failed/error tests
|
240
|
+
return if result_status == :passed
|
241
|
+
|
242
|
+
super
|
243
|
+
end
|
244
|
+
end
|
217
245
|
end
|
218
246
|
end
|
@@ -21,9 +21,17 @@ class Tryouts
|
|
21
21
|
VerboseFormatter.new(options)
|
22
22
|
end
|
23
23
|
when :compact
|
24
|
-
|
24
|
+
if options[:fails_only]
|
25
|
+
CompactFailsFormatter.new(options)
|
26
|
+
else
|
27
|
+
CompactFormatter.new(options)
|
28
|
+
end
|
25
29
|
when :quiet
|
26
|
-
|
30
|
+
if options[:fails_only]
|
31
|
+
QuietFailsFormatter.new(options)
|
32
|
+
else
|
33
|
+
QuietFormatter.new(options)
|
34
|
+
end
|
27
35
|
else
|
28
36
|
VerboseFormatter.new(options) # Default to verbose
|
29
37
|
end
|
@@ -26,7 +26,7 @@ class Tryouts
|
|
26
26
|
# Silent in quiet mode
|
27
27
|
end
|
28
28
|
|
29
|
-
def file_execution_start(file_path,
|
29
|
+
def file_execution_start(file_path, _test_count, _context_mode)
|
30
30
|
@current_file = file_path
|
31
31
|
end
|
32
32
|
|
@@ -98,15 +98,21 @@ class Tryouts
|
|
98
98
|
|
99
99
|
puts
|
100
100
|
|
101
|
+
time_str = if elapsed_time < 2
|
102
|
+
"#{(elapsed_time * 1000).to_i}ms"
|
103
|
+
else
|
104
|
+
"#{elapsed_time.round(2)}s"
|
105
|
+
end
|
106
|
+
|
101
107
|
issues_count = failed_count + error_count
|
102
108
|
if issues_count > 0
|
103
109
|
passed = total_tests - issues_count
|
104
110
|
details = []
|
105
111
|
details << "#{failed_count} failed" if failed_count > 0
|
106
112
|
details << "#{error_count} errors" if error_count > 0
|
107
|
-
puts Console.color(:red, "Total: #{details.join(', ')}, #{passed} passed (#{
|
113
|
+
puts Console.color(:red, "Total: #{details.join(', ')}, #{passed} passed (#{time_str})")
|
108
114
|
else
|
109
|
-
puts Console.color(:green, "Total: #{total_tests} passed (#{
|
115
|
+
puts Console.color(:green, "Total: #{total_tests} passed (#{time_str})")
|
110
116
|
end
|
111
117
|
|
112
118
|
if total_files > 1
|
@@ -139,5 +145,15 @@ class Tryouts
|
|
139
145
|
# Silent in quiet mode
|
140
146
|
end
|
141
147
|
end
|
148
|
+
|
149
|
+
# Quiet formatter that only shows dots for failures and errors
|
150
|
+
class QuietFailsFormatter < QuietFormatter
|
151
|
+
def test_result(test_case, result_status, actual_results = [], elapsed_time = nil)
|
152
|
+
# Only show non-pass dots in fails mode
|
153
|
+
return if result_status == :passed
|
154
|
+
|
155
|
+
super
|
156
|
+
end
|
157
|
+
end
|
142
158
|
end
|
143
159
|
end
|
@@ -10,12 +10,14 @@ class Tryouts
|
|
10
10
|
@line_width = options.fetch(:line_width, 70)
|
11
11
|
@show_passed = options.fetch(:show_passed, true)
|
12
12
|
@show_debug = options.fetch(:debug, false)
|
13
|
-
@show_trace = options.fetch(:trace,
|
13
|
+
@show_trace = options.fetch(:trace, false)
|
14
14
|
@current_indent = 0
|
15
15
|
end
|
16
16
|
|
17
17
|
# Phase-level output
|
18
18
|
def phase_header(message, _file_count = nil, level = 0)
|
19
|
+
return if level.equal?(1)
|
20
|
+
|
19
21
|
separators = [
|
20
22
|
{ char: '=', width: @line_width }, # Major phases
|
21
23
|
{ char: '-', width: @line_width - 10 }, # Sub-phases
|
@@ -43,20 +45,11 @@ class Tryouts
|
|
43
45
|
|
44
46
|
# File-level operations
|
45
47
|
def file_start(file_path, _context_info = {})
|
46
|
-
# framework = context_info[:framework] || :direct
|
47
|
-
# context = context_info[:context] || :fresh
|
48
|
-
|
49
|
-
# with_indent(1) do
|
50
|
-
# puts "Framework: #{framework}"
|
51
|
-
# puts "Context: #{context}"
|
52
|
-
# end
|
53
|
-
|
54
48
|
puts file_header_visual(file_path)
|
55
49
|
end
|
56
50
|
|
57
|
-
def file_parsed(
|
58
|
-
|
59
|
-
message = "Parsed #{test_count} test cases from #{pretty_path}"
|
51
|
+
def file_parsed(_file_path, _test_count, setup_present: false, teardown_present: false)
|
52
|
+
message = ''
|
60
53
|
|
61
54
|
extras = []
|
62
55
|
extras << 'setup' if setup_present
|
@@ -85,11 +78,15 @@ class Tryouts
|
|
85
78
|
end
|
86
79
|
|
87
80
|
puts indent_text(status, 2)
|
81
|
+
return unless elapsed_time
|
88
82
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
83
|
+
time_msg =
|
84
|
+
if elapsed_time < 2.0
|
85
|
+
"Completed in #{(elapsed_time * 1000).round}ms"
|
86
|
+
else
|
87
|
+
"Completed in #{elapsed_time.round(3)}s"
|
88
|
+
end
|
89
|
+
puts indent_text(Console.color(:dim, time_msg), 2)
|
93
90
|
end
|
94
91
|
|
95
92
|
# Test-level operations
|
@@ -130,7 +127,7 @@ class Tryouts
|
|
130
127
|
end
|
131
128
|
end
|
132
129
|
|
133
|
-
def test_output(
|
130
|
+
def test_output(_test_case, output_text)
|
134
131
|
return if output_text.nil? || output_text.strip.empty?
|
135
132
|
|
136
133
|
puts indent_text('Test Output:', 3)
|
@@ -193,14 +190,21 @@ class Tryouts
|
|
193
190
|
puts 'Grand Total:'
|
194
191
|
|
195
192
|
issues_count = failed_count + error_count
|
193
|
+
time_str =
|
194
|
+
if elapsed_time < 2.0
|
195
|
+
" (#{(elapsed_time * 1000).round}ms)"
|
196
|
+
else
|
197
|
+
" (#{elapsed_time.round(2)}s)"
|
198
|
+
end
|
199
|
+
|
196
200
|
if issues_count > 0
|
197
201
|
passed = total_tests - issues_count
|
198
202
|
details = []
|
199
203
|
details << "#{failed_count} failed" if failed_count > 0
|
200
204
|
details << "#{error_count} errors" if error_count > 0
|
201
|
-
puts "#{details.join(', ')}, #{passed} passed
|
205
|
+
puts "#{details.join(', ')}, #{passed} passed#{time_str}"
|
202
206
|
else
|
203
|
-
puts "#{total_tests} tests passed
|
207
|
+
puts "#{total_tests} tests passed#{time_str}"
|
204
208
|
end
|
205
209
|
|
206
210
|
puts "Files processed: #{successful_files} of #{total_files} successful"
|
data/lib/tryouts/console.rb
CHANGED
@@ -121,15 +121,15 @@ class Tryouts
|
|
121
121
|
style(ATTRIBUTES[:default], COLOURS[:default], BGCOLOURS[:default])
|
122
122
|
end
|
123
123
|
|
124
|
-
# Converts an absolute file path to a path relative to the
|
125
|
-
#
|
124
|
+
# Converts an absolute file path to a path relative to the current working
|
125
|
+
# directory. This simplifies logging and error reporting by showing
|
126
126
|
# only the relevant parts of file paths instead of lengthy absolute paths.
|
127
127
|
#
|
128
128
|
def pretty_path(file)
|
129
129
|
return nil if file.nil?
|
130
130
|
|
131
131
|
file = File.expand_path(file) # be absolutely sure
|
132
|
-
basepath =
|
132
|
+
basepath = Dir.pwd
|
133
133
|
Pathname.new(file).relative_path_from(basepath).to_s
|
134
134
|
end
|
135
135
|
end
|
@@ -56,7 +56,7 @@ class Tryouts
|
|
56
56
|
@global_tally[:total_errors] += file_error_count
|
57
57
|
@global_tally[:successful_files] += 1 if success
|
58
58
|
|
59
|
-
duration = Time.now - @file_start
|
59
|
+
duration = Time.now.to_f - @file_start.to_f
|
60
60
|
@output_manager.file_success(@file, batch.size, file_failed_count, file_error_count, duration)
|
61
61
|
|
62
62
|
# Combine failures and errors to determine the exit code.
|
data/lib/tryouts/version.rb
CHANGED
data/lib/tryouts.rb
CHANGED