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

Error stacks are broken in Jest watch mode for source mapped files #6424

Closed
ArtemGovorov opened this issue Jun 9, 2018 · 5 comments
Closed

Comments

@ArtemGovorov
Copy link
Contributor

🐛 Bug Report

Error stacks for source mapped files are not always correctly reported in watch mode.

To Reproduce

  • clone https://github.com/ArtemGovorov/jest-watch-mode-source-map-issue,
  • run npm i,
  • run npm test,
  • touch the __tests__/a.spec.js file to get the test running,
  • observe a correctly reported exception line,
  • uncomment the second line of the test file to let Babel transform the import.
  • save the file,
  • observe an incorrectly reported exception line.

jest

Expected behavior

The error stack should be correctly reported.

Link to repl or repo (highly encouraged)

https://github.com/ArtemGovorov/jest-watch-mode-source-map-issue

Run npx envinfo --preset jest

System:
    OS: macOS High Sierra 10.13.3
    CPU: x64 Intel(R) Xeon(R) W-2140B CPU @ 3.20GHz
  Binaries:
    Node: 9.6.1 - /usr/local/bin/node
    Yarn: 1.6.0 - ~/.yarn/bin/yarn
    npm: 6.1.0 - ~/.nvm/versions/node/v10.3.0/bin/npm
  npmPackages:
    jest: ^23.1.0 => 23.1.0
@SimenB
Copy link
Member

SimenB commented Jun 9, 2018

Does this only happen in watch mode? If so, it's probably a caching bug

@ArtemGovorov
Copy link
Contributor Author

ArtemGovorov commented Jun 9, 2018

It does happen only in watch mode. After restarting, the error is displayed correctly.

ArtemGovorov added a commit to ArtemGovorov/node-source-map-support that referenced this issue Feb 22, 2019
…eFile` functions

The `handlerExec` function produces functions that are using original `retrieveFileHandlers`/`retrieveMapHandlers` references, so because the array variables are  re-assigned in the `resetRetrieveHandlers` function, `retrieveSourceMap` and `retrieveFile` need to be re-created to point them to correct instances of `retrieveFileHandlers`/`retrieveMapHandlers`.

This fixes:
jestjs/jest#6424
jestjs/jest#7402
@SimenB
Copy link
Member

SimenB commented Feb 20, 2020

@ArtemGovorov you've solved this upstream?

@SimenB
Copy link
Member

SimenB commented Feb 11, 2022

Works correctly in Jest 27 and refreshing the lockfile, so calling this one fixed 🙂

@SimenB SimenB closed this as completed Feb 11, 2022
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2022
bestlucky0825 pushed a commit to bestlucky0825/node-source-map-support that referenced this issue May 30, 2022
…eFile` functions

The `handlerExec` function produces functions that are using original `retrieveFileHandlers`/`retrieveMapHandlers` references, so because the array variables are  re-assigned in the `resetRetrieveHandlers` function, `retrieveSourceMap` and `retrieveFile` need to be re-created to point them to correct instances of `retrieveFileHandlers`/`retrieveMapHandlers`.

This fixes:
jestjs/jest#6424
jestjs/jest#7402
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants