-
Notifications
You must be signed in to change notification settings - Fork 156
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
Update ts-jest version and api #246
Conversation
I want to fix |
Updated package.json |
Looks good to me ❤️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the lag on this review.
Won't this be a breaking change for anyone on the older version of ts-jest
and jest
? Is there any good way to handle verisoning for vue-jest?
The code itself looks fine.
I think we need to move to match jest versions. But we also need some way to version for both Vue 2 and Vue 3. Does anyone have any ideas?
enIf you are only using ts-jest with getTsJestConfig, then you can use ts- It's easy to create a backward compatible version without using jest. const configs = tr.configsFor(config)
return { compilerOptions: (configs.typescript || configs.parsedTsConfig).options } I think it will work if you write something like. jagetTsJestConfig でしかts-jestをつかっていないのなら、ts-jestを使わないで後方互換を保ったのを作るのは容易です. const configs = tr.configsFor(config)
return { compilerOptions: (configs.typescript || configs.parsedTsConfig).options } のように書けば動くと思います |
Good idea. @seriouslag are you able to add this: const configs = tr.configsFor(config)
return { compilerOptions: (configs.typescript || configs.parsedTsConfig).options } This will make backwards compat no problem. Once you add this, I can do a release. |
I can't wait for this pull request ❤️ |
Notice that |
handles ts-jest old and new api
I have made the changes. |
Alright I will do a release with this fantastic improvement this weekend. Thanks! |
Can we have this fix merged with v4.0.0-beta3 as well and another release for v4.0.0-beta3? |
I will release v4.0.0-beta4 today (or whatever beta version we are up to). |
I think at some points |
Yes, I think we should rewrite a significant chunk of this based on typescript and ts-jest. Is this something you would be interested in contributing to? I am definitely keen, but mostly busy with vuejs#vue-test-utils and vuejs#vue-test-utils-next... The entire codebase is around 1k lines, it would probably be easily to do a fresh start for Vue 3 support. Honestly I think it would take less than a day to have something working, we more or less just wrap Anything special to keep in mind when writing a jest transformer? |
sure I can help with the rewriting. IMO, the most special thing to note is if Vue compiler has some AST transformers related to typescript content, Getting the experience with |
Until now we just called the functions exposed in the compiler-sfc: https://github.com/vuejs/vue-next/tree/master/packages/compiler-sfc. This is build on the compiler-core: https://github.com/vuejs/vue-next/tree/master/packages/compiler-core which has all kinds of fun stuff. I believe we can get the AST information there (for example this ast.ts file. I know very little about compilers and this is currently outside my understanding, but I would really like to learn more about this. Can you share some links (for example how the Angular team did this?) It sounds like instead of using a I don't fully understand "jest-preset-angular now needs to invoke those AST transformers". |
Related to AST transformers, it depends actually. For the case of Angular, to compile HTML and ts, Angular team uses some AST transformers to attach metadata for their compiler and use TypeScript API with those AST transformers. I think the current implementation of About the compilers, I'm not entirely familiar with the whole Angular compiler. Currently The easiest way to start with TypeScript compiler is from TypeScript doc Once you are familiar with these simple examples, you can check more complex things like:
I think I like the name |
Just wanna quickly chime in from the issue above. |
It’s kind of odd that I would expect npm/yarn automatically pulls latest 18 with ts-jest 25. Probably it can be yarn/npm issue too that it should pull the latest 18 |
Yeah, possibly. I'd target dependency issues before I targeted yarn tho |
Let's update the deps (in another PR/issue). |
- pick from vuejs#246
The typescript object was not defined on the result of the configsFor(config) in our project.
On inspection we found that parsedTsConfig and _parsedTsConfig of the configsFor result had the correct object.
Using:
in the jest.config.js we have defined the globals as