-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Stacktrace for errors in Cypress command log does not match the file when using Typescript #26668
Comments
@amenk Thanks for the reporting the issue. Can you please try on the latest version of Cypress to see if you can still reproduce this? Also, can you please provide a reproducible example of the issue you're encountering. Here are some tips for providing a Short, Self Contained, Correct, Example and our own Troubleshooting Cypress guide. |
@warrensplayer Thanks, we tried 12.11.0 as well - same issue - on different machines. Will try to cook up a smaller example. |
This comment was marked as resolved.
This comment was marked as resolved.
Thanks @amenk, https://github.com/cypress-io/cypress-test-tiny might be useful to make the repro. It seems like there could be many variables at play. A quick test for me showed normal behavior when clicking through from a failing test - got to the correct line and character in the file in VS Code. |
okay, thanks. Will try to provide better info soon. |
Yeah this is interesting, happy to take a closer look if we can reproduce - otherwise it will be very difficult to track down and verify that we have fixed something. |
Hello, I'm facing the same bug, but I'm using Typescript. I made a repro based on the tiny cypress project. https://github.com/Breek/cypress-test-tiny 2 commits:
It goes to line 25, but shoud go to 32 for the failing test. Happy to help, |
Cool, we use a mix of TS and JS files by the way. |
Thanks for the repro @jchatard and the screenshot :), I confirmed with the repro provided that simply changing the extension in the Cypress test from Looks like a longstanding bug, I confirmed it all the way back in 9.7.0. Routing to the team to check it out further. |
Actually worth noting that typescript was not a part of your screenshots @amenk, I see a js file there. Can you confirm does |
@marktnoonan Good point. |
I also have a problem with the stack trace. The printed line numbers do not match the line numbers in the source files: Note that the stack trace shows the compiled javascript, for example Our project uses pure TypeScript for Cypress, e.g.:
And so on. I tried many different settings in tsconfig.json to get the source maps working correctly, but to no avail. I use: |
Are there any plans to fix this, please? |
Same problem |
I'm able to reproduce this with strictly .js files. At one point two weeks ago we played around with typescript for a plugin, but found a js friendly implementation later. Even after resetting everything to js and uninstalling typescript, the problem persists. Sometimes in larger spec files it's hundreds of lines off, making debugging more tedious than it should be. |
I had the same problem for years and found a fix today that works for me: Add Explanation: When I open the browser’s developer tools, I can see my spec and support files under webpack, like It seems like Cypress uses @cypress/webpack-batteries-included-preprocessor. In this code, I found a line where some compiler options are set if sourceMap is not set: https://github.com/cypress-io/cypress/blob/develop/npm/webpack-batteries-included-preprocessor/index.js#L40 |
Current behavior
Line numbers of stack trace don't match the code in cypress 12.8
Basically the same like in
#7715
Desired behavior
The line numbers match the code
Test code to reproduce
Cypress Version
12.8.0
Node version
16.17.0
Operating System
Ubuntu 22.04
Debug Logs
No response
Other
No response
The text was updated successfully, but these errors were encountered: