-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Documentation is not clear about how to use source maps in custom transformers #10305
Comments
Can I grab it? |
@Mskat sure! :) |
There is a code snippet in https://jestjs.io/docs/next/code-transformation#writing-custom-transformers (next version doc), reading the types you can see the structure expected by the source map. But maybe if the code is transformed and no source map is provided, maybe jest shouldn't try to display the position in the file where the error occurs. |
A note about the shape of the return value of I don't think we should try to detect if source maps are used - code might be transformed in a way that does not change line/column position etc.. If you transform the code, you should return sourcemaps, and us assuming that code running is either original or provide source maps seems like a fine assumption to make |
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. |
🐛 Bug Report
Documentation is not clear about how to use source maps in custom transformers.
Additionally, if you don't pass any source maps, jest will report a failed assertion in a random position in the original not transformed source code.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Inform how the source map should be returned by a custom transformer.
If the code was transformed and the source map was not provided, don't just assume the lines and columns will match.
Link to repl or repo (highly encouraged)
https://repl.it/@fcostarodrigo/JestCustomTransformIssue
I am using CoffeeScript just as an example.
envinfo
The text was updated successfully, but these errors were encountered: