Skip to content

Failed cy.exec should log full errorΒ #5470

Open
@mxstbr

Description

@mxstbr

Current behavior:

When calling a command that fails with cy.exec, the stderr output is truncated:

CypressError: cy.exec('script/setup') failed because the command exited with a non-zero code.
Stderr:
go: finding github.com/package1 v2.3.1
go: finding github.com/package2 v0.0.3
go: finding github.com/package3 v0.0.0
go: finding g...
      at Object.cypressErr (http://localhost:3001/__cypress/runner/cypress_runner.js:85348:11)
      at Object.throwErr (http://localhost:3001/__cypress/runner/cypress_runner.js:85303:18)
      at Object.throwErrByPath (http://localhost:3001/__cypress/runner/cypress_runner.js:85335:17)
      at http://localhost:3001/__cypress/runner/cypress_runner.js:72714:23
      at tryCatcher (http://localhost:3001/__cypress/runner/cypress_runner.js:118962:23)
      at Promise._settlePromiseFromHandler (http://localhost:3001/__cypress/runner/cypress_runner.js:116898:31)
      at Promise._settlePromise (http://localhost:3001/__cypress/runner/cypress_runner.js:116955:18)
      at Promise._settlePromise0 (http://localhost:3001/__cypress/runner/cypress_runner.js:117000:10)
      at Promise._settlePromises (http://localhost:3001/__cypress/runner/cypress_runner.js:117079:18)
      at Async../node_modules/bluebird/js/release/async.js.Async._drainQueue (http://localhost:3001/__cypress/runner/cypress_runner.js:113687:16)
      at Async../node_modules/bluebird/js/release/async.js.Async._drainQueues (http://localhost:3001/__cypress/runner/cypress_runner.js:113697:10)
      at Async.drainQueues (http://localhost:3001/__cypress/runner/cypress_runner.js:113571:14)
      at <anonymous>

Desired behavior:

Cypress should log the full stderr output to allow debugging of the issue:

CypressError: cy.exec('script/setup') failed because the command exited with a non-zero code.
Stderr:
go: finding github.com/package1 v2.3.1
go: finding github.com/package2 v0.0.3
go: finding github.com/package3 v0.0.0
go: finding golang.org/x/net v0.0.0-20190613194153-d28f0bde5980
go: github.com/[email protected]: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /home/runner/go/pkg/mod/cache/vcs/075ee809aae0177b65597ee0f28e756d8e2e5e438325d9b042470844e74f817e: exit status 128:
	fatal: could not read Username for 'https://github.com': terminal prompts disabled

Steps to reproduce: (app code and test code)

Call cy.exec with a command that fails with a long error (e.g. stack trace).

Versions

Cypress 3.4.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions