Skip to content

Commit

Permalink
fix: avoid ANSI character output when running the binary smoke test f… (
Browse files Browse the repository at this point in the history
  • Loading branch information
AtofStryker authored Feb 22, 2024
1 parent c3cbe6f commit c1304b2
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 6 deletions.
10 changes: 5 additions & 5 deletions .circleci/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -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+$/
Expand All @@ -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+$/
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
<!-- See the ../guides/writing-the-cypress-changelog.md for details on writing the changelog. -->
## 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_
Expand Down
5 changes: 4 additions & 1 deletion cli/lib/tasks/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})

Expand Down
38 changes: 38 additions & 0 deletions cli/test/lib/tasks/verify_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

4 comments on commit c1304b2

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on c1304b2 Feb 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.6.6/linux-arm64/develop-c1304b2775a843e9a7a122adcf2ec352517cbec6/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on c1304b2 Feb 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.6.6/linux-x64/develop-c1304b2775a843e9a7a122adcf2ec352517cbec6/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on c1304b2 Feb 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.6.6/darwin-x64/develop-c1304b2775a843e9a7a122adcf2ec352517cbec6/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on c1304b2 Feb 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.6.6/win32-x64/develop-c1304b2775a843e9a7a122adcf2ec352517cbec6/cypress.tgz

Please sign in to comment.