Skip to content

Commit

Permalink
fix: no longer swallow stderr logs on linux (#28380)
Browse files Browse the repository at this point in the history
  • Loading branch information
emilyrohrbough authored Dec 5, 2023
1 parent 257861b commit f53ca92
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 49 deletions.
1 change: 1 addition & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ _Released 12/5/2023 (PENDING)_
- Fixed an issue where request logging would default the `message` to the `args` of the currently running command even though those `args` would not apply to the request log and are not displayed. If the `args` are sufficiently large (e.g. when running the `cy.task` from the [code-coverage](/~https://github.com/cypress-io/code-coverage/) plugin) there could be performance/memory implications. Addressed in [#28411](/~https://github.com/cypress-io/cypress/pull/28411).
- Fixed an issue where commands would fail with the error `must only be invoked from the spec file or support file` if the project's `baseUrl` included basic auth credentials. Fixes [#28336](/~https://github.com/cypress-io/cypress/issues/28336).
- Fixed an issue where some URLs would timeout in pre-request correlation. Addressed in [#28427](/~https://github.com/cypress-io/cypress/pull/28427).
- Cypress will now correctly log errors and debug logs on Linux machines. Fixes [#5051](/~https://github.com/cypress-io/cypress/issues/5051) and [#24713](/~https://github.com/cypress-io/cypress/issues/24713).

**Misc:**

Expand Down
17 changes: 2 additions & 15 deletions cli/lib/exec/spawn.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const cp = require('child_process')
const path = require('path')
const Promise = require('bluebird')
const debug = require('debug')('cypress:cli')
const debugElectron = require('debug')('cypress:electron')

const util = require('../util')
const state = require('../tasks/state')
Expand Down Expand Up @@ -122,10 +121,9 @@ module.exports = {
return new Promise((resolve, reject) => {
_.defaults(overrides, {
onStderrData: false,
electronLogging: false,
})

const { onStderrData, electronLogging } = overrides
const { onStderrData } = overrides
const envOverrides = util.getEnvOverrides(options)
const electronArgs = []
const node11WindowsFix = isPlatform('win32')
Expand Down Expand Up @@ -160,10 +158,6 @@ module.exports = {
stdioOptions = _.extend({}, stdioOptions, { windowsHide: false })
}

if (electronLogging) {
stdioOptions.env.ELECTRON_ENABLE_LOGGING = true
}

if (util.isPossibleLinuxWithIncorrectDisplay()) {
// make sure we use the latest DISPLAY variable if any
debug('passing DISPLAY', process.env.DISPLAY)
Expand Down Expand Up @@ -241,7 +235,7 @@ module.exports = {

// if we have a callback and this explicitly returns
// false then bail
if (onStderrData && onStderrData(str) === false) {
if (onStderrData && onStderrData(str)) {
return
}

Expand Down Expand Up @@ -294,13 +288,6 @@ module.exports = {
if (util.isBrokenGtkDisplay(str)) {
brokenGtkDisplay = true
}

// we should attempt to always slurp up
// the stderr logs unless we've explicitly
// enabled the electron debug logging
if (!debugElectron.enabled) {
return false
}
},
})
}
Expand Down
6 changes: 1 addition & 5 deletions cli/lib/tasks/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,8 @@ const runSmokeTest = (binaryDir, options) => {
debug('smoke test command:', smokeTestCommand)
debug('smoke test timeout %d ms', options.smokeTestTimeout)

const env = _.extend({}, process.env, {
ELECTRON_ENABLE_LOGGING: true,
})

const stdioOptions = _.extend({}, {
env,
env: process.env,
timeout: options.smokeTestTimeout,
})

Expand Down
29 changes: 0 additions & 29 deletions cli/test/lib/tasks/verify_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,35 +278,6 @@ context('lib/tasks/verify', () => {
})
})

it('sets ELECTRON_ENABLE_LOGGING without mutating process.env', () => {
createfs({
alreadyVerified: false,
executable: mockfs.file({ mode: 0o777 }),
packageVersion,
})

expect(process.env.ELECTRON_ENABLE_LOGGING).to.be.undefined

util.exec.resolves()
sinon.stub(util, 'stdoutLineMatches').returns(true)

return verify
.start()
.then(() => {
expect(process.env.ELECTRON_ENABLE_LOGGING).to.be.undefined

const stdioOptions = util.exec.firstCall.args[2]

expect(stdioOptions).to.include({
timeout: verify.VERIFY_TEST_RUNNER_TIMEOUT_MS,
})

expect(stdioOptions.env).to.include({
ELECTRON_ENABLE_LOGGING: true,
})
})
})

describe('with force: true', () => {
beforeEach(() => {
createfs({
Expand Down

5 comments on commit f53ca92

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on f53ca92 Dec 5, 2023

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.1/linux-arm64/develop-f53ca92f5c7376d98ef7877d4f0ce894b981a0a2/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on f53ca92 Dec 5, 2023

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.1/linux-x64/develop-f53ca92f5c7376d98ef7877d4f0ce894b981a0a2/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on f53ca92 Dec 5, 2023

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.1/darwin-x64/develop-f53ca92f5c7376d98ef7877d4f0ce894b981a0a2/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on f53ca92 Dec 5, 2023

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 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.1/darwin-arm64/develop-f53ca92f5c7376d98ef7877d4f0ce894b981a0a2/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on f53ca92 Dec 5, 2023

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.1/win32-x64/develop-f53ca92f5c7376d98ef7877d4f0ce894b981a0a2/cypress.tgz

Please sign in to comment.