File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change 3
3
4
4
const dayjs = require ( 'dayjs' )
5
5
var duration = require ( 'dayjs/plugin/duration' )
6
- const { filterFilesFromCoverage } = require ( './support-utils' )
6
+ const {
7
+ filterFilesFromCoverage,
8
+ getSendCoverageBatchSize
9
+ } = require ( './support-utils' )
7
10
8
11
dayjs . extend ( duration )
9
12
@@ -16,8 +19,24 @@ const sendCoverage = (coverage, pathname = '/') => {
16
19
17
20
const totalCoverage = filterFilesFromCoverage ( coverage )
18
21
22
+ const envBatchSize = getSendCoverageBatchSize ( )
23
+ const keys = Object . keys ( totalCoverage )
24
+
25
+ if ( envBatchSize && envBatchSize < keys . length ) {
26
+ sendBatchCoverage ( totalCoverage , envBatchSize )
27
+ } else {
28
+ cy . task ( 'combineCoverage' , JSON . stringify ( totalCoverage ) , {
29
+ log : false
30
+ } )
31
+ }
32
+ }
33
+
34
+ /**
35
+ * Sends collected code coverage object to the backend code
36
+ * in batches via "cy.task".
37
+ */
38
+ const sendBatchCoverage = ( totalCoverage , batchSize ) => {
19
39
const keys = Object . keys ( totalCoverage )
20
- const batchSize = 500
21
40
22
41
for ( let i = 0 ; i < keys . length ; i += batchSize ) {
23
42
const batchKeys = keys . slice ( i , i + batchSize )
You can’t perform that action at this time.
0 commit comments