From c1304b2775a843e9a7a122adcf2ec352517cbec6 Mon Sep 17 00:00:00 2001 From: Bill Glesias Date: Thu, 22 Feb 2024 14:29:49 -0500 Subject: [PATCH] =?UTF-8?q?fix:=20avoid=20ANSI=20character=20output=20when?= =?UTF-8?q?=20running=20the=20binary=20smoke=20test=20f=E2=80=A6=20(#28994?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .circleci/workflows.yml | 10 ++++---- cli/CHANGELOG.md | 8 +++++++ cli/lib/tasks/verify.js | 5 +++- cli/test/lib/tasks/verify_spec.js | 38 +++++++++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 6 deletions(-) diff --git a/.circleci/workflows.yml b/.circleci/workflows.yml index 61965fa7fb12..2338737cb514 100644 --- a/.circleci/workflows.yml +++ b/.circleci/workflows.yml @@ -30,7 +30,7 @@ mainBuildFilters: &mainBuildFilters - /^release\/\d+\.\d+\.\d+$/ # use the following branch as well to ensure that v8 snapshot cache updates are fully tested - 'cacie/dep/electron-27' - - 'chore/update_octokit' + - 'fix/force_colors_on_verify' - 'publish-binary' - 'em/circle2' @@ -44,7 +44,7 @@ macWorkflowFilters: &darwin-workflow-filters # use the following branch as well to ensure that v8 snapshot cache updates are fully tested - equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ] - equal: [ 'cacie/dep/electron-27', << pipeline.git.branch >> ] - - equal: [ 'chore/update_octokit', << pipeline.git.branch >> ] + - equal: [ 'fix/force_colors_on_verify', << pipeline.git.branch >> ] - equal: [ 'ryanm/fix/service-worker-capture', << pipeline.git.branch >> ] - matches: pattern: /^release\/\d+\.\d+\.\d+$/ @@ -57,7 +57,7 @@ linuxArm64WorkflowFilters: &linux-arm64-workflow-filters # use the following branch as well to ensure that v8 snapshot cache updates are fully tested - equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ] - equal: [ 'cacie/dep/electron-27', << pipeline.git.branch >> ] - - equal: [ 'chore/update_octokit', << pipeline.git.branch >> ] + - equal: [ 'fix/force_colors_on_verify', << pipeline.git.branch >> ] - equal: [ 'em/circle2', << pipeline.git.branch >> ] - matches: pattern: /^release\/\d+\.\d+\.\d+$/ @@ -82,7 +82,7 @@ windowsWorkflowFilters: &windows-workflow-filters # use the following branch as well to ensure that v8 snapshot cache updates are fully tested - equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ] - equal: [ 'cacie/dep/electron-27', << pipeline.git.branch >> ] - - equal: [ 'chore/update_octokit', << pipeline.git.branch >> ] + - equal: [ 'fix/force_colors_on_verify', << pipeline.git.branch >> ] - equal: [ 'lerna-optimize-tasks', << pipeline.git.branch >> ] - equal: [ 'mschile/mochaEvents_win_sep', << pipeline.git.branch >> ] - matches: @@ -154,7 +154,7 @@ commands: name: Set environment variable to determine whether or not to persist artifacts command: | echo "Setting SHOULD_PERSIST_ARTIFACTS variable" - echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "publish-binary" && "$CIRCLE_BRANCH" != "chore/update_octokit" && "$CIRCLE_BRANCH" != "cacie/dep/electron-27" ]]; then + echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "publish-binary" && "$CIRCLE_BRANCH" != "fix/force_colors_on_verify" && "$CIRCLE_BRANCH" != "cacie/dep/electron-27" ]]; then export SHOULD_PERSIST_ARTIFACTS=true fi' >> "$BASH_ENV" # You must run `setup_should_persist_artifacts` command and be using bash before running this command diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index f0b41069d072..b43ce8922a9f 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -1,4 +1,12 @@ +## 13.6.6 + +_Released 2/22/2024 (PENDING)_ + +**Bugfixes:** + +- Fixed an issue where `cypress verify` was failing for `nx` users. Fixes [#28982](https://github.com/cypress-io/cypress/issues/28982). + ## 13.6.5 _Released 2/20/2024_ diff --git a/cli/lib/tasks/verify.js b/cli/lib/tasks/verify.js index 2d946b301e37..87e44412b67b 100644 --- a/cli/lib/tasks/verify.js +++ b/cli/lib/tasks/verify.js @@ -102,7 +102,10 @@ const runSmokeTest = (binaryDir, options) => { debug('smoke test timeout %d ms', options.smokeTestTimeout) const stdioOptions = _.extend({}, { - env: process.env, + env: { + ...process.env, + FORCE_COLOR: 0, + }, timeout: options.smokeTestTimeout, }) diff --git a/cli/test/lib/tasks/verify_spec.js b/cli/test/lib/tasks/verify_spec.js index ab4fd5146be0..356a8f0c478d 100644 --- a/cli/test/lib/tasks/verify_spec.js +++ b/cli/test/lib/tasks/verify_spec.js @@ -278,6 +278,44 @@ context('lib/tasks/verify', () => { }) }) + describe('FORCE_COLOR', () => { + let previousForceColors + + beforeEach(() => { + previousForceColors = process.env.FORCE_COLOR + + process.env.FORCE_COLOR = true + }) + + afterEach(() => { + process.env.FORCE_COLOR = previousForceColors + }) + + // @see https://github.com/cypress-io/cypress/issues/28982 + it('sets FORCE_COLOR to 0 when piping stdioOptions to to the smoke test to avoid ANSI in binary smoke test', () => { + createfs({ + alreadyVerified: false, + executable: mockfs.file({ mode: 0o777 }), + packageVersion, + }) + + util.exec.resolves({ + stdout: '222', + stderr: '', + }) + + return verify.start() + .then(() => { + expect(util.exec).to.be.calledWith(executablePath, ['--no-sandbox', '--smoke-test', '--ping=222'], + sinon.match({ + env: { + FORCE_COLOR: 0, + }, + })) + }) + }) + }) + describe('with force: true', () => { beforeEach(() => { createfs({