Skip to content

Commit

Permalink
test: other test improvements
Browse files Browse the repository at this point in the history
- added missing translations from #7542
- migrated away from deprecated codecov gem
  • Loading branch information
adi-herwana-nus committed Oct 6, 2024
1 parent 0cf92d6 commit 4c42549
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 12 deletions.
12 changes: 6 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ commands:
- run:
name: Wait for Rails coverage results
no_output_timeout: 5m
command: until [ -f coverage/codecov-result.json ]; do sleep 1; done
command: until [ -f coverage/coverage.xml ]; do sleep 1; done

setup_docker_layer_cache:
steps:
Expand Down Expand Up @@ -301,13 +301,9 @@ jobs:
command: |
zip -r test-results.zip test-results playright-report
# - codecov/upload:
# upload_name: playwright-client
# file: tests/coverage/lcov.info

- codecov/upload:
upload_name: playwright-rails
file: coverage/codecov-result.json
file: coverage/coverage.xml

- store_test_results:
path: ~/repo/tests/results.xml
Expand Down Expand Up @@ -343,6 +339,10 @@ jobs:
mkdir ~/rspec
circleci tests glob "spec/**/*_spec.rb" | circleci tests run --command="xargs bundle exec rspec --format progress --format RspecJunitFormatter -o ~/rspec/rspec.xml" --verbose --split-by=timings
- codecov/upload:
upload_name: rspec-rails
file: coverage/coverage.xml

- store_test_results:
path: ~/rspec

Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ group :development, :test do

# Code Coverage reporters
gem 'simplecov'
gem 'codecov', require: false
gem 'simplecov-cobertura'

gem 'dotenv-rails'
end
Expand Down
7 changes: 4 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,6 @@ GEM
marcel (~> 1.0.0)
ssrf_filter (~> 1.0)
childprocess (5.0.0)
codecov (0.6.0)
simplecov (>= 0.15, < 0.22)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
consistency_fail (0.3.7)
Expand Down Expand Up @@ -562,6 +560,9 @@ GEM
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-cobertura (2.1.0)
rexml
simplecov (~> 0.19)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
slim (5.2.1)
Expand Down Expand Up @@ -629,7 +630,6 @@ DEPENDENCIES
capybara-screenshot
capybara-selenium
carrierwave (~> 3)
codecov
consistency_fail
coursemology-polyglot
csv
Expand Down Expand Up @@ -695,6 +695,7 @@ DEPENDENCIES
sidekiq
sidekiq-cron
simplecov
simplecov-cobertura
slim-rails
spring
stackprof
Expand Down
4 changes: 2 additions & 2 deletions config/initializers/coverage.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# frozen_string_literal: true
if Rails.env.test? && ENV['COLLECT_COVERAGE'] == 'true'
require 'simplecov'
require 'codecov'
require 'simplecov-cobertura'

SimpleCov.formatter = SimpleCov::Formatter::Codecov
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter

SimpleCov.start('rails') do
add_filter '/lib/extensions/legacy/active_record/connection_adapters/table_definition.rb'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
zh:
activerecord:
errors:
models:
course/monitoring/heartbeat:
attributes:
seb_payload:
invalid_seb_payload: 'seb payload 必须为空或为有效的 JSON 对象'
4 changes: 4 additions & 0 deletions config/locales/zh/activerecord/course/monitoring/monitor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ zh:
must_be_password_protected: '评估必须受密码保护才能启用'
max_interval_ms:
greater_than_min_interval: '必须大于最小间隔'
blocks:
must_have_browser_authorization_and_session_protection: '必须启用浏览器授权和会话保护'
seb_config_key:
required_if_using_seb_config_key_browser_authorization: '使用 seb 配置密钥浏览器授权方法时必须提供 seb 配置密钥'

0 comments on commit 4c42549

Please sign in to comment.