Skip to content
This repository was archived by the owner on Jul 23, 2025. It is now read-only.

Commit 8a7376a

Browse files
committed
Add support for batch-size when uploading code coverage
1 parent 8a09d38 commit 8a7376a

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/main.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ export interface ActionArguments {
3838
verifyDownload?: string;
3939
/** Verifies if the current OS and CPU architecture is supported by CodeClimate test reporter. */
4040
verifyEnvironment?: string;
41+
/** Batch size for source files used by upload-coverage command (default 500) */
42+
batchSize?: number;
4143
}
4244

4345
const CURRENT_ENVIRONMENT = getSupportedEnvironmentInfo();
@@ -59,6 +61,7 @@ const DEFAULT_CODECLIMATE_DEBUG = 'false';
5961
const DEFAULT_COVERAGE_LOCATIONS = '';
6062
const DEFAULT_VERIFY_DOWNLOAD = 'true';
6163
const DEFAULT_VERIFY_ENVIRONMENT = 'true';
64+
const DEFAULT_BATCH_SIZE = 500;
6265

6366
const SUPPORTED_GITHUB_EVENTS = [
6467
// Regular PRs.
@@ -206,6 +209,7 @@ export async function run({
206209
workingDirectory = DEFAULT_WORKING_DIRECTORY,
207210
codeClimateDebug = DEFAULT_CODECLIMATE_DEBUG,
208211
coverageLocationsParam = DEFAULT_COVERAGE_LOCATIONS,
212+
batchSize = DEFAULT_BATCH_SIZE,
209213
coveragePrefix,
210214
verifyDownload = DEFAULT_VERIFY_DOWNLOAD,
211215
verifyEnvironment = DEFAULT_VERIFY_ENVIRONMENT,
@@ -368,6 +372,9 @@ export async function run({
368372
// Upload to Code Climate.
369373
const uploadCommands = ['upload-coverage', '-i', 'coverage.total.json'];
370374
if (codeClimateDebug === 'true') uploadCommands.push('--debug');
375+
if (batchSize) {
376+
uploadCommands.push('--batch-size', batchSize.toString());
377+
}
371378
try {
372379
lastExitCode = await exec(executable, uploadCommands, execOpts);
373380
if (lastExitCode !== 0) {

test/main.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ t.test('🧪 run() should run the CC reporter (happy path).', async (t) => {
183183
coverageCommand: `${ECHO_CMD} 'coverage ok'`,
184184
verifyDownload: 'false',
185185
verifyEnvironment: 'false',
186+
batchSize: 200,
186187
});
187188
stdHook.unhook();
188189
} catch (err) {

0 commit comments

Comments
 (0)