Skip to content

Commit

Permalink
feature: implement ci timeout pass flag
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelangarano committed Sep 27, 2023
1 parent dd41486 commit 76d048b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
7 changes: 7 additions & 0 deletions packages/cypress-cloud/bin/lib/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions packages/cypress-cloud/lib/api/types/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export type CreateRunPayload = {
batchSize?: number;
autoCancelAfterFailures: ValidatedCurrentsParameters["autoCancelAfterFailures"];
coverageEnabled?: boolean;
ciTimeoutPass?: boolean;
};

export type CloudWarning = {
Expand Down
6 changes: 3 additions & 3 deletions packages/cypress-cloud/lib/bootstrap/serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ function getCypressCLIParams(
const testingType =
result.testingType === "component"
? {
component: true,
}
component: true,
}
: {};
return {
..._.omit(result, "testingType"),
..._.omit(result, "testingType", "ciTimeoutPass"),
...testingType,
};
}
Expand Down
5 changes: 3 additions & 2 deletions packages/cypress-cloud/lib/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export async function run(params: CurrentsRunParameters = {}) {
batchSize,
autoCancelAfterFailures,
experimentalCoverageRecording,
ciTimeoutPass
} = validatedParams;

const config = await getMergedConfig(validatedParams);
Expand All @@ -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...");
Expand All @@ -109,6 +109,7 @@ export async function run(params: CurrentsRunParameters = {}) {
batchSize,
autoCancelAfterFailures,
coverageEnabled: experimentalCoverageRecording,
ciTimeoutPass
});

setRunId(run.runId);
Expand Down
7 changes: 6 additions & 1 deletion packages/cypress-cloud/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 76d048b

Please sign in to comment.