Skip to content
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

No stack traces in cypress run and inconsistent from cypress open #823

Closed
samtgarson opened this issue Oct 26, 2017 · 10 comments
Closed

No stack traces in cypress run and inconsistent from cypress open #823

samtgarson opened this issue Oct 26, 2017 · 10 comments
Milestone

Comments

@samtgarson
Copy link

  • Operating System: OSX
  • Cypress Version: 0.20.1
  • Browser Version: 61.0.3163.100 (Official Build) (64-bit)

Is this a Feature or Bug?

Bug

Current behavior:

Using a Nuxt app and cypress run from the command line, the tests linked below show an Uncaught SyntaxError: Unexpected identifier with no stack trace, but work perfectly when using cypress open

Commenting out cy.visit seems to fix the error, but obviously the tests still fail which suggest to me it's an error when processing the page however I don't know how to find out any further than that without any clues.

Desired behavior:

The behaviour in open and run should be the same, but also primarily there should be stack traces to debug syntax errors.

How to reproduce:

Basic versions of the tests and results shown here: https://gist.github.com/samtgarson/dadd2d760c7701c8ab0c2ee8e89bd9a4

I can't share the entire repo but if you have no idea where to begin I can try to recreate with a basic example.

Test code:

Above

Additional Info (images, stack traces, etc)

Above

@jennifer-shehane
Copy link
Member

jennifer-shehane commented Oct 26, 2017

Have you tried running the tests with cypress open and selecting the Electron browser? We use Electron to run headlessly in cypress run. I'm wondering if the error would show up there.

@samtgarson
Copy link
Author

Thanks for the quick reply! It does show a stack trace there but seems to be internal?

image

@samtgarson
Copy link
Author

(Incidentally—just upgraded to v1.0.2, to keep this issue accurate...)

@brian-mann
Copy link
Member

Cypress does not print a stack trace when the error originated from itself (since it throws hundreds of different error messages).

There's no way there's an unexpected identifier in Cypress itself so I'd be curious why its thinking the error came from itself...

I believe this is actually an uncaught exception from your application. I'd have to investigate why Cypress is not immediately printing the stack trace which would point you to your application.

We probably should upgrade the error message to also be much clearer that its from your app as opposed to something else.

Lastly, if my assumptions are correct you can use the uncaught:exception event to capture this error instance directly (by using a debugger).

The docs for that are here: https://docs.cypress.io/api/cypress-api/custom-commands.html#Syntax

@brian-mann
Copy link
Member

Also the actual underlying problem is likely due to your application using newer ES**** code that's available in Chrome 62 but is not available in Electron 53 (which is really Chromium 53).

@brian-mann
Copy link
Member

brian-mann commented Oct 26, 2017

Opened an issue here to update the errors to indicate where they originated. #825

This is still separate from the stack trace problem - Cypress always displays the stack trace on any error that it itself did not throw. I'm not sure why its not being displayed here.

@samtgarson
Copy link
Author

samtgarson commented Oct 26, 2017

Yeah I did assume the error was from my app and that that was the cause—I was more filing this as the error is quite vague (and not super helpful—although the other errors I've encountered in Cypress have been very helpful!)

Do you know any easy way to boot up the electron browser myself to see if I can find the error that way? The payload from that uncaught:exception is not giving me much... (I've not done much work with Electron...)

@samtgarson
Copy link
Author

aha... I've got it. Thanks for your help. Shall I close this issue?

@brian-mann
Copy link
Member

You can use the Electron browser by switching to it in the GUI (which you already did)

It runs headlessly by default from cypress run but you can just pass --headed and it will display like the GUI.

@jennifer-shehane jennifer-shehane added this to the 2.0.0 milestone Feb 8, 2018
@brian-mann
Copy link
Member

Released in 2.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants