Skip to content

Commit c1304b2

Browse files
authored
fix: avoid ANSI character output when running the binary smoke test f… (#28994)
1 parent c3cbe6f commit c1304b2

File tree

4 files changed

+55
-6
lines changed

4 files changed

+55
-6
lines changed

.circleci/workflows.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ mainBuildFilters: &mainBuildFilters
3030
- /^release\/\d+\.\d+\.\d+$/
3131
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
3232
- 'cacie/dep/electron-27'
33-
- 'chore/update_octokit'
33+
- 'fix/force_colors_on_verify'
3434
- 'publish-binary'
3535
- 'em/circle2'
3636

@@ -44,7 +44,7 @@ macWorkflowFilters: &darwin-workflow-filters
4444
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
4545
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
4646
- equal: [ 'cacie/dep/electron-27', << pipeline.git.branch >> ]
47-
- equal: [ 'chore/update_octokit', << pipeline.git.branch >> ]
47+
- equal: [ 'fix/force_colors_on_verify', << pipeline.git.branch >> ]
4848
- equal: [ 'ryanm/fix/service-worker-capture', << pipeline.git.branch >> ]
4949
- matches:
5050
pattern: /^release\/\d+\.\d+\.\d+$/
@@ -57,7 +57,7 @@ linuxArm64WorkflowFilters: &linux-arm64-workflow-filters
5757
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
5858
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
5959
- equal: [ 'cacie/dep/electron-27', << pipeline.git.branch >> ]
60-
- equal: [ 'chore/update_octokit', << pipeline.git.branch >> ]
60+
- equal: [ 'fix/force_colors_on_verify', << pipeline.git.branch >> ]
6161
- equal: [ 'em/circle2', << pipeline.git.branch >> ]
6262
- matches:
6363
pattern: /^release\/\d+\.\d+\.\d+$/
@@ -82,7 +82,7 @@ windowsWorkflowFilters: &windows-workflow-filters
8282
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
8383
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
8484
- equal: [ 'cacie/dep/electron-27', << pipeline.git.branch >> ]
85-
- equal: [ 'chore/update_octokit', << pipeline.git.branch >> ]
85+
- equal: [ 'fix/force_colors_on_verify', << pipeline.git.branch >> ]
8686
- equal: [ 'lerna-optimize-tasks', << pipeline.git.branch >> ]
8787
- equal: [ 'mschile/mochaEvents_win_sep', << pipeline.git.branch >> ]
8888
- matches:
@@ -154,7 +154,7 @@ commands:
154154
name: Set environment variable to determine whether or not to persist artifacts
155155
command: |
156156
echo "Setting SHOULD_PERSIST_ARTIFACTS variable"
157-
echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "publish-binary" && "$CIRCLE_BRANCH" != "chore/update_octokit" && "$CIRCLE_BRANCH" != "cacie/dep/electron-27" ]]; then
157+
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
158158
export SHOULD_PERSIST_ARTIFACTS=true
159159
fi' >> "$BASH_ENV"
160160
# You must run `setup_should_persist_artifacts` command and be using bash before running this command

cli/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
<!-- See the ../guides/writing-the-cypress-changelog.md for details on writing the changelog. -->
2+
## 13.6.6
3+
4+
_Released 2/22/2024 (PENDING)_
5+
6+
**Bugfixes:**
7+
8+
- Fixed an issue where `cypress verify` was failing for `nx` users. Fixes [#28982](https://github.com/cypress-io/cypress/issues/28982).
9+
210
## 13.6.5
311

412
_Released 2/20/2024_

cli/lib/tasks/verify.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ const runSmokeTest = (binaryDir, options) => {
102102
debug('smoke test timeout %d ms', options.smokeTestTimeout)
103103

104104
const stdioOptions = _.extend({}, {
105-
env: process.env,
105+
env: {
106+
...process.env,
107+
FORCE_COLOR: 0,
108+
},
106109
timeout: options.smokeTestTimeout,
107110
})
108111

cli/test/lib/tasks/verify_spec.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,44 @@ context('lib/tasks/verify', () => {
278278
})
279279
})
280280

281+
describe('FORCE_COLOR', () => {
282+
let previousForceColors
283+
284+
beforeEach(() => {
285+
previousForceColors = process.env.FORCE_COLOR
286+
287+
process.env.FORCE_COLOR = true
288+
})
289+
290+
afterEach(() => {
291+
process.env.FORCE_COLOR = previousForceColors
292+
})
293+
294+
// @see https://github.com/cypress-io/cypress/issues/28982
295+
it('sets FORCE_COLOR to 0 when piping stdioOptions to to the smoke test to avoid ANSI in binary smoke test', () => {
296+
createfs({
297+
alreadyVerified: false,
298+
executable: mockfs.file({ mode: 0o777 }),
299+
packageVersion,
300+
})
301+
302+
util.exec.resolves({
303+
stdout: '222',
304+
stderr: '',
305+
})
306+
307+
return verify.start()
308+
.then(() => {
309+
expect(util.exec).to.be.calledWith(executablePath, ['--no-sandbox', '--smoke-test', '--ping=222'],
310+
sinon.match({
311+
env: {
312+
FORCE_COLOR: 0,
313+
},
314+
}))
315+
})
316+
})
317+
})
318+
281319
describe('with force: true', () => {
282320
beforeEach(() => {
283321
createfs({

0 commit comments

Comments
 (0)