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 33
44const dayjs = require ( 'dayjs' )
55var duration = require ( 'dayjs/plugin/duration' )
6- const { filterFilesFromCoverage } = require ( './support-utils' )
6+ const {
7+ filterFilesFromCoverage,
8+ getSendCoverageBatchSize
9+ } = require ( './support-utils' )
710
811dayjs . extend ( duration )
912
@@ -16,8 +19,24 @@ const sendCoverage = (coverage, pathname = '/') => {
1619
1720 const totalCoverage = filterFilesFromCoverage ( coverage )
1821
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 ) => {
1939 const keys = Object . keys ( totalCoverage )
20- const batchSize = 500
2140
2241 for ( let i = 0 ; i < keys . length ; i += batchSize ) {
2342 const batchKeys = keys . slice ( i , i + batchSize )
You can’t perform that action at this time.
0 commit comments