You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Guess this is the same issue I have... causes tests to fail.
cypress_runner.js:65225 Uncaught TypeError: Cannot read property 'replace' of undefined
at Object.appendErrMsg (cypress_runner.js:65225)
at Object.createUncaughtException (cypress_runner.js:58408)
at Object.onUncaughtException (cypress_runner.js:61281)
at onError (cypress_runner.js:60780)
I've just spent an hour getting to know Cypress intimately to track down the error I was getting. Spoiler: turns out the error was that electron doesn't currently support optional catch binding in try block:
try{
...
}catch{
...
}
The error I was receiving was:
Uncaught SyntaxError: Unexpected token {
This error originated from your application code, not from Cypress.
When Cypress detects uncaught errors originating from your application it will automatically fail the current test.
This behavior is configurable, and you can choose to turn this off by listening to the 'uncaught:exception' event.
https://on.cypress.io/uncaught-exception-from-application
This doesn't contain anything useful for tracking down what is causing the error since there's {s everywhere.
After much exploration through the devtools I landed here:
This gave me the information I needed - the file, line number and column number of the syntax error. From then it only took a few more seconds to track down the actual syntax incompatibility.
The issue here seems to be that the source, lineno and colno information are being explicitly dropped here:
## if we have the 5th argument it means we're in a super
## modern browser making this super simple to work with.
err?=createErrFromMsg()
Because the error (argument 5) exists, the other details are discarded, which leads to a less-than-optimal debugging experience.
As far as I can tell, there's no way for me to extract these details with any cypress hooks, for example by the time it hits the uncaught:exception hook these details have been dropped (I think?).
Suggestion: add source, lineno and colno to the error object and ensure they're in the error message.
The code for this is done in cypress-io/cypress#3930, but has yet to be released.
We'll update this issue and reference the changelog when it's released.
Activity
[-]Improve Errors[/-][+]Improve Uncaught Errors[/+]mackelito commentedon Feb 13, 2019
Guess this is the same issue I have... causes tests to fail.
benjie commentedon Aug 21, 2019
I've just spent an hour getting to know Cypress intimately to track down the error I was getting. Spoiler: turns out the error was that electron doesn't currently support optional catch binding in
try
block:The error I was receiving was:
This doesn't contain anything useful for tracking down what is causing the error since there's
{
s everywhere.After much exploration through the devtools I landed here:
This gave me the information I needed - the file, line number and column number of the syntax error. From then it only took a few more seconds to track down the actual syntax incompatibility.
The issue here seems to be that the source, lineno and colno information are being explicitly dropped here:
cypress/packages/driver/src/cy/errors.coffee
Lines 29 to 30 in 55b352a
cypress/packages/driver/src/cy/errors.coffee
Lines 39 to 44 in 55b352a
Because the error (argument 5) exists, the other details are discarded, which leads to a less-than-optimal debugging experience.
As far as I can tell, there's no way for me to extract these details with any cypress hooks, for example by the time it hits the
uncaught:exception
hook these details have been dropped (I think?).Suggestion: add
source
,lineno
andcolno
to the error object and ensure they're in the error message.cypress-bot commentedon May 6, 2020
The code for this is done in cypress-io/cypress#3930, but has yet to be released.
We'll update this issue and reference the changelog when it's released.
cypress-bot commentedon May 20, 2020
Released in
4.6.0
.This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v4.6.0, please open a new issue.