-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
simplecov-ruby/simplecov#718 Rails6のパラレルテスト対策
- Loading branch information
1 parent
0c5f2ce
commit 48e2708
Showing
2 changed files
with
27 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,34 @@ | ||
ENV['RAILS_ENV'] ||= 'test' | ||
# [Qiita: SimpleCovとRails 6のMinitest](https://qiita.com/kazutosato/items/382afd90caf64b644e77) | ||
# https://github.com/simplecov-ruby/simplecov/issues/718 | ||
|
||
if ENV['COVERAGE'] | ||
require 'simplecov' | ||
|
||
require 'simplecov' | ||
SimpleCov.start | ||
SimpleCov.start 'rails' | ||
end | ||
|
||
require_relative "../config/environment" | ||
require "rails/test_help" | ||
ENV['RAILS_ENV'] ||= 'test' | ||
require_relative '../config/environment' | ||
require 'rails/test_help' | ||
|
||
class ActiveSupport::TestCase | ||
## Run tests in parallel with specified workers | ||
# parallelize(workers: :number_of_processors) | ||
# Run tests in parallel with specified workers | ||
parallelize(workers: :number_of_processors) | ||
|
||
if ENV['COVERAGE'] | ||
parallelize_setup do |worker| | ||
SimpleCov.command_name "#{SimpleCov.command_name}-#{worker}" | ||
end | ||
|
||
parallelize_teardown do |worker| | ||
SimpleCov.result | ||
end | ||
end | ||
|
||
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. | ||
fixtures :all | ||
|
||
# Add more helper methods to be used by all tests here... | ||
|
||
# include FactoryBot::Syntax::Methods | ||
end |