-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: give proper error message when err.stack is undefined #5313
Merged
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0cf8031
fix: give proper error message when err.stack is undefined
kuceb 4c39e87
Merge branch 'develop' into fix-undefined-err-stack
kuceb 236af1d
Merge remote-tracking branch 'origin/develop' into fix-undefined-err-…
kuceb 40102af
Merge remote-tracking branch 'origin/fix-undefined-err-stack' into fi…
kuceb 43b5642
fix lint
kuceb fab9970
Merge branch 'develop' into fix-undefined-err-stack
kuceb 8ff8314
update snapshot
kuceb 3c775c4
Merge remote-tracking branch 'origin/develop' into fix-undefined-err-…
kuceb e7139ec
update test to fail w/o src changes
kuceb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
exports['e2e issue 2891 passes 1'] = ` | ||
|
||
==================================================================================================== | ||
|
||
(Run Starting) | ||
|
||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│ Cypress: 1.2.3 │ | ||
│ Browser: FooBrowser 88 │ | ||
│ Specs: 1 found (issue_1669_spec.js) │ | ||
│ Searched: cypress/integration/issue_1669_spec.js │ | ||
└────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
|
||
|
||
──────────────────────────────────────────────────────────────────────────────────────────────────── | ||
|
||
Running: issue_1669_spec.js (1 of 1) | ||
|
||
|
||
issue-1669 undefined err.stack in beforeEach hook | ||
1) "before each" hook for "cy.setCookie should fail with correct error" | ||
|
||
|
||
0 passing | ||
1 failing | ||
|
||
1) issue-1669 undefined err.stack in beforeEach hook "before each" hook for "cy.setCookie should fail with correct error": | ||
CypressError: cy.setCookie() must be passed an RFC-6265-compliant cookie value. You passed: | ||
|
||
\` bar\` | ||
|
||
Because this error occurred during a 'before each' hook we are skipping the remaining tests in the current suite: 'issue-1669 undefined err.st...' | ||
at stack trace line | ||
at stack trace line | ||
at stack trace line | ||
at stack trace line | ||
at stack trace line | ||
at stack trace line | ||
at stack trace line | ||
at stack trace line | ||
at stack trace line | ||
at stack trace line | ||
at stack trace line | ||
at stack trace line | ||
|
||
|
||
|
||
|
||
(Results) | ||
|
||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│ Tests: 1 │ | ||
│ Passing: 0 │ | ||
│ Failing: 1 │ | ||
│ Pending: 0 │ | ||
│ Skipped: 0 │ | ||
│ Screenshots: 1 │ | ||
│ Video: true │ | ||
│ Duration: X seconds │ | ||
│ Spec Ran: issue_1669_spec.js │ | ||
└────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
|
||
|
||
(Screenshots) | ||
|
||
- /XXX/XXX/XXX/cypress/screenshots/issue_1669_spec.js/issue-1669 undefined err.sta (1280x720) | ||
ck in beforeEach hook -- cy.setCookie should fail with correct error -- before e | ||
ach hook (failed).png | ||
|
||
|
||
(Video) | ||
|
||
- Started processing: Compressing to 32 CRF | ||
- Finished processing: /XXX/XXX/XXX/cypress/videos/issue_1669_spec.js.mp4 (X second) | ||
|
||
|
||
==================================================================================================== | ||
|
||
(Run Finished) | ||
|
||
|
||
Spec Tests Passing Failing Pending Skipped | ||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│ ✖ issue_1669_spec.js XX:XX 1 - 1 - - │ | ||
└────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
✖ 1 of 1 failed (100%) XX:XX 1 - 1 - - | ||
|
||
|
||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
e2e = require("../support/helpers/e2e") | ||
Fixtures = require("../support/helpers/fixtures") | ||
|
||
describe "e2e issue 2891", -> | ||
e2e.setup() | ||
|
||
## https://github.com/cypress-io/cypress/issues/2891 | ||
|
||
it "passes", -> | ||
e2e.exec(@, { | ||
spec: "issue_1669_spec.js" | ||
snapshot: true | ||
browser: 'chrome' | ||
expectedExitCode: 1 | ||
}) |
9 changes: 9 additions & 0 deletions
9
packages/server/test/support/fixtures/projects/e2e/cypress/integration/issue_1669_spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
describe('issue-1669 undefined err.stack in beforeEach hook', () => { | ||
beforeEach(() => { | ||
cy.setCookie('foo', ' bar') | ||
}) | ||
|
||
it('cy.setCookie should fail with correct error', () => { | ||
expect(true).ok | ||
}) | ||
}) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bkucera if you merge in
develop
, I believe this was fixed to err correctly and no longer causes anerr.stack === undefined
, you may need to come up with a custom command to get the error you wantAlso, just curious, is there a reason why is this an
e2e
test and not just a normal driver test that asserts on the error usingcy.on('fail', (err) => {...})
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you catch the error in the 'fail' handler, it has not yet hit the logic that reads off .stack
I'll merge in develop, and try locally without these changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, it did pass without the src changes, so I changed the test that now fails without these changes