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

Sourcemaps point to wrong line number in Cypress in TypeScript version 5 #28483

Open
jennifer-shehane opened this issue Dec 8, 2023 · 5 comments
Assignees
Labels
prevent-stale mark an issue so it is ignored by stale[bot] topic: typescript type: bug

Comments

@jennifer-shehane
Copy link
Member

jennifer-shehane commented Dec 8, 2023

Current behavior

Sourcemaps point to the wrong line number in some version of TS 5.

*Note: There were some earlier reports of the stack trace not displaying at all in an error, but this was never reproducible.

Desired behavior

In order to get sourcemaps to work we have to do some monkeypatching to force the sourcemap options to generate them the way we expect. There's likely something that's changed in some version of TS 5 here.

Test code to reproduce

TS code - don't have repro

Cypress Version

13.6.1

Node version

18

Operating System

Mac

Debug Logs

No response

Other

No response

@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label Jun 6, 2024
@TimVee
Copy link

TimVee commented Jun 7, 2024

The line numbers of assertions errors in run mode are still incorrect.

@jennifer-shehane jennifer-shehane added prevent-stale mark an issue so it is ignored by stale[bot] and removed stale no activity on this issue for a long period labels Jun 7, 2024
@ryanthemanuel
Copy link
Collaborator

@TimVee or anyone else following this issue, I've been spending some time looking into this and I'm not able to reproduce this with a couple of scenarios I've tried. Do you have a minimal example of this failing for you that I can take a look at?

@TimVee
Copy link

TimVee commented Dec 19, 2024

I could reproduce it easily:

  1. Created a new project
  2. pnpm init
  3. pnpm add cypress typescript
  4. npx cypress open
  5. Let Cypress scaffold the example test cases
  6. Added tsconfig.json
    {
      "compilerOptions": {
        "target": "ES2018",
        "lib": ["ES2018"],
        "types": [],
        "moduleResolution": "node"
      },
      "include": ["**/*.ts"]
    }
  7. Renamed cypress/e2e/1-getting-started/todo.cy.js to .ts
  8. Added an error in the test.
  9. Ran the test

I added the error on line 24, but in the Cypress test runner that becomes line 21:

Code_v64FczDf04

@jennifer-shehane
Copy link
Member Author

@TimVee This issue seems different from the original issue - which is that NO stack trace is available for viewing in the error. I do see this being a problem though, that the lines are off sometimes. I think we'll update this issue to track that since the other situation hasn't been demonstrated.

@jennifer-shehane jennifer-shehane changed the title Sourcemaps are broken in Cypress in TypeScript version 5 Sourcemaps point to wrong line number in Cypress in TypeScript version 5 Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prevent-stale mark an issue so it is ignored by stale[bot] topic: typescript type: bug
Projects
None yet
Development

No branches or pull requests

4 participants