cypress-cloud
Version:
92 lines (88 loc) • 3.84 kB
TypeScript
type TestingType = Cypress.TestingType;
declare enum DebugMode {
None = "none",
All = "all",
Currents = "currents",
Cypress = "cypress",
CommitInfo = "commit-info"
}
type StrippedCypressModuleAPIOptions = Omit<Partial<CypressCommandLine.CypressRunOptions>, "autoCancelAfterFailures" | "tag" | "spec" | "exit" | "headed" | "record" | "headless" | "noExit" | "parallel" | "key" | "tag" | "group" | "ciBuildId" | "cloudConfigFile">;
type CurrentsRunParameters = StrippedCypressModuleAPIOptions & {
/** The CI build ID to use for the run */
ciBuildId?: string;
/** The batch size defines how many spec files will be served in one orchestration "batch". If not specified, will use the projectId from currents.config.js, the default value is 1 (i.e. no batching) */
batchSize?: number;
/** Whether to activate record mode and connect to cloud orchestration service */
record?: boolean;
/** The URL of the currents server to use. If not specified, will use the one from currents.config.js */
cloudServiceUrl?: string;
/** The environment variables to use for the run */
env?: object;
/** The group id to use for the run */
group?: string;
/** The record key to use */
recordKey?: string;
/** Whether to run the spec files in parallel */
parallel?: boolean;
/** The project ID to use. */
projectId?: string;
/** Comma-separated string or an array of spec glob pattern for the execution */
spec?: string | string[];
/** Comma-separated string or an array of tags */
tag?: string | string[];
/** "e2e" or "component", the default value is "e2e" */
testingType?: TestingType;
/** Automatically abort the run after the specified number of failed tests. Overrides the default project settings. If set, must be a positive integer or "false" to disable (Currents-only) */
autoCancelAfterFailures?: number | false;
/**
* Whether to launch cypress in headed mode. If set, must be a boolean, defaults to false.
*/
headed?: boolean;
/**
* Configuration file name or absolute path. Default value is 'currents.config.js', if specified, must be a string. The file will be resolved relative to the project root, unless it's an absolute path.
*/
cloudConfigFile?: string;
/**
* Enable debug mode for cypress-cloud, this will print out logs for troubleshooting.
*/
cloudDebug?: DebugMode | true | string | string[];
/**
* Whether to record coverage results. If set, must be a boolean, defaults to false.
*/
experimentalCoverageRecording?: boolean;
};
interface CurrentsRunAPI extends CurrentsRunParameters {
}
type E2EConfig = {
batchSize: number;
};
type ComponentConfig = {
batchSize: number;
};
type RetryConfig = {
hardFailureMaxRetries: number;
};
/**
* This is the type for `currents.config.*s`. If you are not officially using TypeScript,
* you can still type the exported config in your IDE by adding the following as a block comment
* above `module.exports` / `export default`:
*
* `@type {import('cypress-cloud').CurrentsConfig}`
*/
type CurrentsConfig = {
projectId?: string;
recordKey?: string;
cloudServiceUrl: string;
e2e: E2EConfig;
component: ComponentConfig;
networkHeaders?: Record<string, string>;
retry?: RetryConfig;
};
/**
* Run Cypress tests with a cloud service of your choice and return the results
*
* @augments CurrentsRunAPI
* @returns {CypressCommandLine.CypressRunResult | CypressCommandLine.CypressFailedRunResult | undefined} The test results, or undefined if no tests were run
*/
declare function run(params?: CurrentsRunAPI): Promise<CypressCommandLine.CypressRunResult | CypressCommandLine.CypressFailedRunResult | undefined>;
export { CurrentsConfig, CurrentsRunAPI, run };