question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Documentation is not clear about how to use source maps in custom transformers

See original GitHub issue

🐛 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:

  1. Visit Custom transformers documentation page.
  2. Create a custom transform following the documentation.
  3. Create a test that fails.
  4. See the jest output pointing at a random position in the original source code.

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

Screenshot 2020-07-23 at 09 03 06

I am using CoffeeScript just as an example.

envinfo

  System:
    OS: Linux 5.4 Debian GNU/Linux 9 (stretch) 9 (stretch)
    CPU: (4) x64 Intel(R) Xeon(R) CPU @ 2.30GHz
  Binaries:
    Node: 12.18.2 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.5 - /usr/local/bin/npm
  npmPackages:
    jest: ^24.9.0 => 24.9.0 

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
SimenBcommented, Apr 4, 2022

#12566 (hopefully clearer now, also #12407)

1reaction
Mskatcommented, Apr 3, 2021

Can I grab it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting Source Maps for JavaScript
Verify your source maps work locally ... If you find that Sentry is not mapping filename, line, or column mappings correctly, you should...
Read more >
Source Maps
If you're writing a custom packager, it's your responsibility to concatenate the source maps of all the assets while packaging. This is done...
Read more >
Create source map from typescript api transformation
So, I input my custom file with a custom syntax and use ts.transform function to walk through the AST tree and change what...
Read more >
Code Transformation
A transformer is a module that provides a method for transforming source files. For example, if you wanted to be able to use...
Read more >
Using Source Maps - Javascript Honeybadger Documentation
The best way to let us know about your source map is to upload your files to our servers every time you deploy...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found