Module: SimpleCov::ResultMerger::Contexts

Extended by:
Contexts
Included in:
Contexts
Defined in:
lib/simplecov/result_merger/contexts.rb

Instance Method Summary collapse

Instance Method Details

#carry(entry, existing, incoming) ⇒ Object

The same union-or-drop rule the cross-suite merge applies: the union when both sides recorded a map, no map at all when either did not, since a partial map would present one runner's tests as the pair's. entry starts as a copy of incoming, so the drop has to remove the key rather than merely decline to add it.



13
14
15
16
17
18
19
# File 'lib/simplecov/result_merger/contexts.rb', line 13

def carry(entry, existing, incoming)
  ours = ContextMap.from_hash(existing["contexts"])
  theirs = ContextMap.from_hash(incoming["contexts"])
  return entry.except("contexts") unless ours && theirs

  entry.merge("contexts" => ours.absorb(theirs).to_h)
end