MCPcopy Create free account
hub / github.com/cypress-io/code-coverage / sendBatchCoverage

Function sendBatchCoverage

lib/support.ts:43–61  ·  view source on GitHub ↗

* Sends collected code coverage object to the backend code * in batches via "cy.task".

(
  totalCoverage: Record<string, unknown>,
  batchSize: number
)

Source from the content-addressed store, hash-verified

41 * in batches via "cy.task".
42 */
43function sendBatchCoverage(
44 totalCoverage: Record<string, unknown>,
45 batchSize: number
46): void {
47 const keys = Object.keys(totalCoverage)
48
49 for (let i = 0; i < keys.length; i += batchSize) {
50 const batchKeys = keys.slice(i, i + batchSize)
51 const batchCoverage: Record<string, unknown> = {}
52
53 batchKeys.forEach((key) => {
54 batchCoverage[key] = totalCoverage[key]
55 })
56
57 cy.task('combineCoverage', JSON.stringify(batchCoverage), {
58 log: false
59 })
60 }
61}
62
63/**
64 * Consistently logs the given string to the Command Log

Callers 1

sendCoverageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…