-
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.
Browse files
Browse the repository at this point in the history
* fix: #3847 only options.log !== false use options._log.error * ADDED issue #3847 behavior test * fix 3847_spec.js prettier
- Loading branch information
1 parent
b6ece46
commit 3eacfeb
Showing
2 changed files
with
43 additions
and
1 deletion.
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
42 changes: 42 additions & 0 deletions
42
packages/driver/test/cypress/integration/issues/3847_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,42 @@ | ||
// https://github.com/cypress-io/cypress/issues/3847 | ||
describe('issue 3847', () => { | ||
// global variable | ||
let queryKey = '\'input\'' | ||
|
||
// like Sizzle throw error | ||
let error = new Error(`Syntax error, unrecognized expression: ${queryKey}`) | ||
|
||
beforeEach(() => { | ||
cy.visit('/fixtures/dom.html') | ||
}) | ||
|
||
it('options default { log: true } should be work without Unhandled rejection', (done) => { | ||
cy.on('fail', (err) => { | ||
expect(err.message).to.eql(error.message) | ||
expect(err.name).to.eql(error.name) | ||
done() | ||
|
||
return false | ||
}) | ||
|
||
// get 'input' | ||
cy.get(queryKey) | ||
}) | ||
|
||
// Unhandled rejection TypeError: Cannot read property 'error' of undefined | ||
it('options { log: false } will not throw Unhandled rejection', (done) => { | ||
|
||
// error should seem like { log: true } | ||
cy.on('fail', (err) => { | ||
expect(err.message).to.eql(error.message) | ||
expect(err.name).to.eql(error.name) | ||
expect(err.message).not.to.match(/Unhandled\srejection\sTypeError/) | ||
done() | ||
|
||
return false | ||
}) | ||
|
||
// get 'input' | ||
cy.get(queryKey, { log: false }) | ||
}) | ||
}) |