SimpleCov::Parallel is a SimpleCov extension for parallelism support. It automatically transfers each node coverage data to a single master node and merges the data. Currently only CircleCI parallelism is supported.
Add these lines to your application's Gemfile:
gem 'simplecov-parallel'
And then execute:
$ bundle install
You just need to invoke SimpleCov::Parallel.activate
before start tracking coverage:
# spec/spec_helper.rb
require 'simplecov/parallel'
SimpleCov::Parallel.activate
SimpleCov.start
SimpleCov::Parallel automatically detects the best parallelism support for the current environment.
You can use any formatter transparently
since SimpleCov::Parallel merges the results into SimpleCov.result
,
which is a basic API of SimpleCov.
When using SimpleCov::Parallel on CircleCI:
- Add
parallel: true
to the test command (e.g.rspec
) in yourcircle.yml
. - Set up parallelism for your project from the CircleCI web console.
# circle.yml
test:
override:
- bundle exec rspec:
parallel: true
files:
- spec/**/*_spec.rb
The SimpleCov formatter will be executed only on the first node (where CIRCLE_NODE_INDEX
is 0
).
The gem is available as open source under the terms of the MIT License.