Skip to content

Commit f1175c5

Browse files
authored
Fix failure on progress bar render (#67)
Fixes two potential runtime errors: - `@cursor` overshooting `tests_length` which leads to a negatively-sized "unfinished" portion of the bar - running quickdraw in a directory with no tests, where `progress = (0.0 / 0)` resolves to `Float::NaN`
1 parent 2c5929f commit f1175c5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/quickdraw/runner.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def supervise(worker)
209209
end
210210

211211
if console
212-
progress = (@cursor * 100.0 / tests_length)
212+
progress = @cursor >= tests_length ? 100.0 : (@cursor * 100.0 / tests_length)
213213
print "\r\e[K#{'█' * (progress * bar_width / 100.0).floor}#{'░' * (bar_width - (progress * bar_width / 100.0).floor)} #{progress.round}%"
214214
end
215215
when Message::Stopping

0 commit comments

Comments
 (0)