-
Notifications
You must be signed in to change notification settings - Fork 454
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
Rely on jest sourcemaps #340
Comments
Oh definitely! I have my eye on that as well |
There are a couple of open PRs/issues for sourcemap in the jest repo (e.g. jestjs/jest#5257 and jestjs/jest#5177). Would love your input on those if applicable, and help testing that it works. |
@SimenB I'll try to find some time after work today to take a look. |
We're about to remove the After that you should be able to use Jest's own support for sourcemaps instead of rolling your own. At least that's the theory! EDIT: Sourcemap support is still out in jest now, so you should be able to rely on Jest installing the source-map support into the environment anyways. The new changes just allows you to return a sooucemap without inlining it in the sourcecode, and drop the |
@SimenB I use ts-jest only for nodejs server side code (unfortunately not open source) and don't have access to a large-ish open source project that could be used here I use angular and its default test setup for the frontend in my personal projects and Jest + Flow at work for the react project That said, I think there have been instances here where folks have linked to relatively larger projects when asked for minimal reproducible repos. Let to try to find some. I'll list them here if I can find any that might help. |
@SimenB Does this look helpful - https://github.com/EYHN/react-typescript-kits? |
Thanks! That went better than expected 🙂 It did not use Vs running with jestjs/jest#5177: So not only does it make coverage work out of the box - it works better than before. This is awesome. (coverage in files actually under test works the same with |
This is fantastic! I'll take a closer look at this next weekend. I think its time to see how this can reduce lines of code in ts-jest 😃 It was discussed a couple of times and didn't go anywhere but I have a feeling the time might be right for jest to subsume ts-jest. |
@kulshekhar jest 22.4.0 has been released, so |
I've set aside time to bring ts-jest up to speed with this |
Judging from your PR - what remains to be done is:
Is that still accurate @kulshekhar ? |
@GeeWee yes |
Think this is related: I'm currently having to hack the ts-jest module to disable the injection of the sourceMapSupport.install() hook to get correct correct line numbers in stack traces ( .... I'm guessing that something else in the tree (jest/jasmine?) is already performing the source-map-support install hook now which doesn't play nice when it's called twice. ts-jest seems to work fine and as expected without the injected code, so maybe it's just not needed anymore? either way it would be nice to be able to disable the sourceMapSupport injection via the global options. |
@chrisfarms I've added this flag (undocumented in the readme) in a new release. Can you see if that works for you? The release notes have some documentation: https://github.com/kulshekhar/ts-jest/releases/tag/v22.4.2 |
@kulshekhar ... yep spotted the release good work thanks ... I have nice correct line numbers again when |
This PR uses the jest infrastructure for sourcemaps. It completely removes any dependance on source-map-support from our part. Note that removing the languageServer is a breaking change - however it was never documented. A language-server branch has been created based off master. This PR is based on #552 so merge that in first. It closes #340. Surprisingly enough it also closes #240 - passing the sourcemaps explicitly to babel means that the line# are correct in the other end - you'll see that in one of the updated tests. It fixes part of #529 Note that no line# has changed, but some column names have in the tests. I'm not sure the original column names were ever accurate.
Jest is about to merge sourcemap support : jestjs/jest#3458
I think if possible we should rely on what they're doing there instead of replicating it ourselves.
It's not possible to act on this issue right now, but I'm just writing it now while I remember.
I'll try to update it when jest merges the sourcemap support in.
The text was updated successfully, but these errors were encountered: