Skip to main content

Using Knapsack Pro in Queue Mode with SimpleCov


This is needed only if you are using Knapsack Pro in Queue Mode.

Apply the following patch:

# spec_helper.rb or rails_helper.rb
require 'knapsack_pro'

require 'simplecov'

KnapsackPro::Hooks::Queue.before_queue do |queue_id|

This is needed to avoid conflicts between code coverage reports generated by parallel CI nodes.

If the local drive is common between parallel nodes on your CI, simplecov will generate a single report at coverage/index.html with merged data. Otherwise, you can refer to How to merge CodeClimate reports for parallel jobs (CI nodes) or How to merge SimpleCov results with parallel Rails specs on Semaphore CI.