-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add elapsed runtime tracking for verbose spec output, fixes #2854 #2855
Conversation
It's a good start, thanks! But given that you want to find what are the slowest tests ran, we could maybe add a Otherwise you'll have to manually sort the times from the output. |
rspec has a --profile mode which outputs the top 10 slowest specs in the suite. I think that's a better approach than printing the time in verbose mode: you typically want to see the slowest tests, not just all runtimes. Agreed? |
Sounds good. Can you choose how many slowest specs to show? |
What do you think about |
|
Any tips on how to add an option default, so the user can pass |
Maybe: require "option_parser"
OptionParser.parse! do |parser|
parser.on("-p", "--profile N", "desc") do |value|
p value # empty string means nothing -p was used
end
end Or: require "option_parser"
OptionParser.parse! do |parser|
parser.on("-p", "--profile", "desc") do
puts "bare"
end
parser.on("--profile N", "desc") do |value|
p value
end
end It seems you can't pass "-p=10" nor "-p 10", but you can pass "-p10" as command line args. I can't remember now why that's like that. Otherwise you can use: require "option_parser"
OptionParser.parse! do |parser|
parser.on("-p", "--profile", "desc") do
puts "bare"
end
parser.on("-p N", "--profile N", "desc") do |value|
p value
end
end but for the second case you must use Too many options to choose now 😊 |
Updated |
Merged as ab52258 Thank you! |
It currently looks like this:
Printing the elapsed time after every line makes for noisy output. I added an arbitrary threshold of 10ms, any tests above this runtime will print out. Better ideas?