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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support synthetic default imports #172
Support synthetic default imports #172
Conversation
@ds300 thanks for the PR! Would it be possible for you to add some tests for this functionality so that future changes don't inadvertently break what this PR adds? |
Sure, no problem. I'll try to add some tomorrow morning. |
@kulshekhar Tests done. |
Thanks @ds300 :) |
Been using this lib for a while, but after this change, getting |
@zamiang can you open this as an issue with link to a minimal repo that reproduces this? It'll help track, debug and fix this much quicker |
It sounds like the async/await annotations are being passed through and compiled by babel, which would happen with TypeScript < 2.1. I hadn't considered that might happen, and we need to account for it 馃 |
Based on a quick search, it seems that others who had a similar issue (unrelated to jest) used |
Ok. Am investigating a repro. FWIW I am using node 6.10, typescript 2.2.2 and my compilation target is ES6. May be related to #177 |
Interesting, what makes you say that? |
Both likely relate to code that was not previously being run through babel, now being run through babel and then compiled by typescript w/ the es2015 target rather than their original target. (fundamentally what this PR does) That is a very large change to the pipeline that causes a difference between the production and testing asset pipeline (at least in my applications which do not use babel and rely on ts-jest + ts-node). In short, the change worries me a lot and makes me question whether it is a good idea more generally. I'm only a couple hours into debugging this but I can currently repro by using ES6 functionality (such as async/await) in tests with |
Hey, thanks for this lib. It has been super helpful 馃憤
As discussed in #146, TypeScript doesn't implement default synthetic imports, so if you want to use those while targeting CommonJS (which Jest requires) you have to add an extra compile step, e.g. with Babel.
Usage of babel-jest as a post-ts-transform step was briefly discussed in #63, and that's what I have done in this PR.
Perf obviously takes a hit, but thanks to Jest's caching you rarely notice.