From 52e97bedd529c3c861d1a59b241646cb125febdc Mon Sep 17 00:00:00 2001 From: ElevateBart Date: Fri, 12 Feb 2021 17:15:39 -0600 Subject: [PATCH 1/3] fix: setup all missing options for run-ct Now that run-ct is using the run command of cypress, it can benefit from a wider range of options. The most important for me was `--headless` but the complete list is longer: - `--parallel` - `--reporter` - `--spec` - `--no-exit` ... among others --- cli/lib/cli.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/cli/lib/cli.js b/cli/lib/cli.js index 61e509a7157..d732a69723a 100644 --- a/cli/lib/cli.js +++ b/cli/lib/cli.js @@ -415,14 +415,25 @@ module.exports = { .command('run-ct', { hidden: true }) .usage('[options]') .description('Runs all Cypress Component Testing suites') - .option('-b, --browser ', text('browserOpenMode')) + .option('-b, --browser ', text('browserRunMode')) + .option('--ci-build-id ', text('ciBuildId')) .option('-c, --config ', text('config')) .option('-C, --config-file ', text('configFile')) - .option('-d, --detached [bool]', text('detached'), coerceFalse) .option('-e, --env ', text('env')) - .option('--global', text('global')) + .option('--group ', text('group')) + .option('-k, --key ', text('key')) + .option('--headed', text('headed')) + .option('--headless', text('headless')) + .option('--no-exit', text('exit')) + .option('--parallel', text('parallel')) .option('-p, --port ', text('port')) .option('-P, --project ', text('project')) + .option('-q, --quiet', text('quiet')) + .option('--record [bool]', text('record'), coerceFalse) + .option('-r, --reporter ', text('reporter')) + .option('-o, --reporter-options ', text('reporterOptions')) + .option('-s, --spec ', text('spec')) + .option('-t, --tag ', text('tag')) .option('--dev', text('dev'), coerceFalse) .action((opts) => { debug('running Cypress run-ct') From 741c580adb9d7c8fda9ee411f01fa253c8ca2540 Mon Sep 17 00:00:00 2001 From: Gleb Bahmutov Date: Sun, 14 Feb 2021 11:20:33 -0500 Subject: [PATCH 2/3] fix: grab bitbucket PR environment variables (#15082) --- packages/server/lib/util/ci_provider.js | 4 ++ packages/server/test/unit/ci_provider_spec.js | 55 +++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/packages/server/lib/util/ci_provider.js b/packages/server/lib/util/ci_provider.js index aafd3c97f05..275b34cc509 100644 --- a/packages/server/lib/util/ci_provider.js +++ b/packages/server/lib/util/ci_provider.js @@ -165,6 +165,10 @@ const _providerCiParams = () => { 'BITBUCKET_BUILD_NUMBER', 'BITBUCKET_PARALLEL_STEP', 'BITBUCKET_STEP_RUN_NUMBER', + // the PR variables are only set on pull request builds + 'BITBUCKET_PR_ID', + 'BITBUCKET_PR_DESTINATION_BRANCH', + 'BITBUCKET_PR_DESTINATION_COMMIT', ]), buildkite: extract([ 'BUILDKITE_REPO', diff --git a/packages/server/test/unit/ci_provider_spec.js b/packages/server/test/unit/ci_provider_spec.js index 4722421b0fc..343b86a09d9 100644 --- a/packages/server/test/unit/ci_provider_spec.js +++ b/packages/server/test/unit/ci_provider_spec.js @@ -213,6 +213,61 @@ describe('lib/util/ci_provider', () => { }) }) + it('bitbucket pull request', () => { + resetEnv = mockedEnv({ + CI: '1', + + // build information + BITBUCKET_BUILD_NUMBER: 'bitbucketBuildNumber', + BITBUCKET_REPO_OWNER: 'bitbucketRepoOwner', + BITBUCKET_REPO_SLUG: 'bitbucketRepoSlug', + BITBUCKET_PARALLEL_STEP: 'bitbucketParallelStep', + BITBUCKET_STEP_RUN_NUMBER: 'bitbucketStepRunNumber', + + // git information + BITBUCKET_COMMIT: 'bitbucketCommit', + BITBUCKET_BRANCH: 'bitbucketBranch', + + // pull request info + BITBUCKET_PR_ID: 'bitbucketPrId', + BITBUCKET_PR_DESTINATION_BRANCH: 'bitbucketPrDestinationBranch', + BITBUCKET_PR_DESTINATION_COMMIT: 'bitbucketPrDestinationCommit', + }, { clear: true }) + + expectsName('bitbucket') + expectsCiParams({ + bitbucketBuildNumber: 'bitbucketBuildNumber', + bitbucketRepoOwner: 'bitbucketRepoOwner', + bitbucketRepoSlug: 'bitbucketRepoSlug', + bitbucketParallelStep: 'bitbucketParallelStep', + bitbucketStepRunNumber: 'bitbucketStepRunNumber', + bitbucketPrId: 'bitbucketPrId', + bitbucketPrDestinationBranch: 'bitbucketPrDestinationBranch', + bitbucketPrDestinationCommit: 'bitbucketPrDestinationCommit', + }) + + expectsCommitParams({ + sha: 'bitbucketCommit', + branch: 'bitbucketBranch', + }) + + expectsCommitDefaults({ + sha: null, + branch: 'gitFoundBranch', + }, { + sha: 'bitbucketCommit', + branch: 'gitFoundBranch', + }) + + return expectsCommitDefaults({ + sha: undefined, + branch: '', + }, { + sha: 'bitbucketCommit', + branch: 'bitbucketBranch', + }) + }) + it('buildkite', () => { resetEnv = mockedEnv({ BUILDKITE: 'true', From 8e462060b242b932cc02147b3656e6760285a362 Mon Sep 17 00:00:00 2001 From: Gleb Bahmutov Date: Sun, 14 Feb 2021 12:34:50 -0500 Subject: [PATCH 3/3] fix: Add autoEnd option to Cypress.Log Typescript definitions (#15076) (#15087) Co-authored-by: Emil Goldsmith Olesen --- cli/types/cypress.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cli/types/cypress.d.ts b/cli/types/cypress.d.ts index 25694223e2a..55cb1924ed9 100644 --- a/cli/types/cypress.d.ts +++ b/cli/types/cypress.d.ts @@ -5424,6 +5424,8 @@ declare namespace Cypress { /** Override *name* for display purposes only */ displayName: string message: any + /** Set to false if you want to control the finishing of the command in the log yourself */ + autoEnd: boolean /** Return an object that will be printed in the dev tools console */ consoleProps(): ObjectLike }