-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle promises rejected with undefined gracefully
- Loading branch information
1 parent
e62faff
commit aa6e8e2
Showing
5 changed files
with
51 additions
and
14 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// /~https://github.com/cypress-io/cypress/issues/23927 | ||
describe('issue 23927', () => { | ||
it('Fails gracefully if origin page throws undefined', () => { | ||
cy.visit('http://barbaz.com:3500/fixtures/generic.html') | ||
cy.origin('http://foobar.com:3500', () => { | ||
Cypress.on('uncaught:exception', (err, runnable) => { | ||
expect(err.message).to.contain('An unknown error has occurred: undefined') | ||
|
||
return false | ||
}) | ||
|
||
cy.visit('http://foobar.com:3500/fixtures/throws-undefined.html') | ||
}) | ||
}) | ||
}) |
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,13 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Promise.reject undefined</title> | ||
</head> | ||
|
||
<body> | ||
<h1> I am going to reject undefined in the document </h1> | ||
</body> | ||
<script> | ||
Promise.reject(undefined) | ||
</script> | ||
</html> |
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