diff --git a/packages/cypress-cloud/bin/lib/program.ts b/packages/cypress-cloud/bin/lib/program.ts index e694397..6e309fa 100644 --- a/packages/cypress-cloud/bin/lib/program.ts +++ b/packages/cypress-cloud/bin/lib/program.ts @@ -129,6 +129,13 @@ ${getLegalNotice()} ) .default(undefined) .argParser((i) => (i === "false" ? false : true)) + ).addOption( + new Option( + `--ci-timeout-pass [bool]`, + `Enable ci runner to pass/fail but no error even if the run timed out` + ) + .default(undefined) + .argParser((i) => (i === "false" ? false : true)) ); export const program = createProgram(); diff --git a/packages/cypress-cloud/lib/api/types/run.ts b/packages/cypress-cloud/lib/api/types/run.ts index 57b54e7..eaa01ce 100644 --- a/packages/cypress-cloud/lib/api/types/run.ts +++ b/packages/cypress-cloud/lib/api/types/run.ts @@ -23,6 +23,7 @@ export type CreateRunPayload = { batchSize?: number; autoCancelAfterFailures: ValidatedCurrentsParameters["autoCancelAfterFailures"]; coverageEnabled?: boolean; + ciTimeoutPass?: boolean; }; export type CloudWarning = { diff --git a/packages/cypress-cloud/lib/bootstrap/serializer.ts b/packages/cypress-cloud/lib/bootstrap/serializer.ts index bd921d7..70355cf 100644 --- a/packages/cypress-cloud/lib/bootstrap/serializer.ts +++ b/packages/cypress-cloud/lib/bootstrap/serializer.ts @@ -66,11 +66,11 @@ function getCypressCLIParams( const testingType = result.testingType === "component" ? { - component: true, - } + component: true, + } : {}; return { - ..._.omit(result, "testingType"), + ..._.omit(result, "testingType", "ciTimeoutPass"), ...testingType, }; } diff --git a/packages/cypress-cloud/lib/run.ts b/packages/cypress-cloud/lib/run.ts index 9ab94b5..bd54c60 100644 --- a/packages/cypress-cloud/lib/run.ts +++ b/packages/cypress-cloud/lib/run.ts @@ -64,6 +64,7 @@ export async function run(params: CurrentsRunParameters = {}) { batchSize, autoCancelAfterFailures, experimentalCoverageRecording, + ciTimeoutPass } = validatedParams; const config = await getMergedConfig(validatedParams); @@ -87,8 +88,7 @@ export async function run(params: CurrentsRunParameters = {}) { info(`Cypress version: ${dim(_cypressVersion)}`); info("Discovered %d spec files", specs.length); info( - `Tags: ${tag.length > 0 ? tag.join(",") : false}; Group: ${ - group ?? false + `Tags: ${tag.length > 0 ? tag.join(",") : false}; Group: ${group ?? false }; Parallel: ${parallel ?? false}; Batch Size: ${batchSize}` ); info("Connecting to cloud orchestration service..."); @@ -109,6 +109,7 @@ export async function run(params: CurrentsRunParameters = {}) { batchSize, autoCancelAfterFailures, coverageEnabled: experimentalCoverageRecording, + ciTimeoutPass }); setRunId(run.runId); diff --git a/packages/cypress-cloud/types.ts b/packages/cypress-cloud/types.ts index 35510d4..6aa9cd5 100644 --- a/packages/cypress-cloud/types.ts +++ b/packages/cypress-cloud/types.ts @@ -173,11 +173,16 @@ export type CurrentsRunParameters = StrippedCypressModuleAPIOptions & { * Whether to record coverage results. If set, must be a boolean, defaults to false. */ experimentalCoverageRecording?: boolean; + + /** + * Flag to allow a github action to pass/fail but no error, if the run is timed out. + */ + ciTimeoutPass?: boolean; }; // User-facing `run` interface // We can resolve the projectId and recordKey from different sources, so we can't really enforce them via the type definition -export interface CurrentsRunAPI extends CurrentsRunParameters {} +export interface CurrentsRunAPI extends CurrentsRunParameters { } // Params after validation and resolution export interface ValidatedCurrentsParameters extends CurrentsRunParameters {