Skip to content

Commit cdeb348

Browse files
committed
Add support function to retrieve and validate 'batch send coverage' environment variable
1 parent 6760dc4 commit cdeb348

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

support-utils.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,19 @@ function fixSourcePaths(coverage) {
148148
})
149149
}
150150

151+
/**
152+
* Validates and returns the configured batch size for
153+
* sending coverage to the backend
154+
*/
155+
function getSendCoverageBatchSize() {
156+
const batchSize = Cypress.env('sendCoverageBatchSize')
157+
const parsedBatchSize = parseInt(batchSize)
158+
const isValid = !isNaN(parsedBatchSize) && parsedBatchSize > 0
159+
return isValid ? parsedBatchSize : null
160+
}
161+
151162
module.exports = {
152163
fixSourcePaths,
153-
filterFilesFromCoverage
164+
filterFilesFromCoverage,
165+
getSendCoverageBatchSize
154166
}

0 commit comments

Comments
 (0)