Skip to content
代码片段 群组 项目
提交 417e01a9 编辑于 作者: Lin Jen-Shin's avatar Lin Jen-Shin
浏览文件

Log RSS when we're printing RSpec elapsed time

上级 63698463
No related branches found
No related tags found
无相关合并请求
...@@ -492,6 +492,7 @@ group :test do ...@@ -492,6 +492,7 @@ group :test do
gem 'rspec_profiling', '~> 0.0.6', feature_category: :tooling gem 'rspec_profiling', '~> 0.0.6', feature_category: :tooling
gem 'rspec-benchmark', '~> 0.6.0', feature_category: :tooling gem 'rspec-benchmark', '~> 0.6.0', feature_category: :tooling
gem 'rspec-parameterized', '~> 1.0', require: false, feature_category: :tooling gem 'rspec-parameterized', '~> 1.0', require: false, feature_category: :tooling
gem 'os', '~> 1.1', feature_category: :tooling
gem 'capybara', '~> 3.39', '>= 3.39.2' # rubocop:todo Gemfile/MissingFeatureCategory gem 'capybara', '~> 3.39', '>= 3.39.2' # rubocop:todo Gemfile/MissingFeatureCategory
gem 'capybara-screenshot', '~> 1.0.26' # rubocop:todo Gemfile/MissingFeatureCategory gem 'capybara-screenshot', '~> 1.0.26' # rubocop:todo Gemfile/MissingFeatureCategory
......
...@@ -1997,6 +1997,7 @@ DEPENDENCIES ...@@ -1997,6 +1997,7 @@ DEPENDENCIES
openid_connect (= 1.3.0) openid_connect (= 1.3.0)
openssl (~> 3.0) openssl (~> 3.0)
org-ruby (~> 0.9.12) org-ruby (~> 0.9.12)
os (~> 1.1)
pact (~> 1.63) pact (~> 1.63)
parallel (~> 1.19) parallel (~> 1.19)
parser (~> 3.2, >= 3.2.2.4) parser (~> 3.2, >= 3.2.2.4)
......
# frozen_string_literal: true # frozen_string_literal: true
require 'os'
require 'yaml' require 'yaml'
require 'rspec/core/formatters/base_formatter' require 'rspec/core/formatters/base_formatter'
require_relative '../../tooling/lib/tooling/helpers/duration_formatter' require_relative '../../tooling/lib/tooling/helpers/duration_formatter'
...@@ -84,11 +85,19 @@ def output_elapsed_time ...@@ -84,11 +85,19 @@ def output_elapsed_time
# skip the output unless the duration increased by at least 1 second # skip the output unless the duration increased by at least 1 second
unless @last_elapsed_seconds.nil? || elapsed_seconds - @last_elapsed_seconds < 1 unless @last_elapsed_seconds.nil? || elapsed_seconds - @last_elapsed_seconds < 1
output.puts "# [RSpecRunTime] RSpec elapsed time: #{readable_duration(elapsed_seconds)}.\n\n" output.puts \
"# [RSpecRunTime] RSpec elapsed time: #{readable_duration(elapsed_seconds)}. " \
"#{current_rss_in_megabytes}\n\n"
end end
@last_elapsed_seconds = elapsed_seconds @last_elapsed_seconds = elapsed_seconds
end end
def current_rss_in_megabytes
rss_in_megabytes = OS.rss_bytes / 1024 / 1024
"Current RSS: ~#{rss_in_megabytes.round}M"
end
end end
end end
end end
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册