Jest testing with Lingui and TypeScript
See original GitHub issueI’ve finally got some time allocated to a catch up on unit tests with our Lingui powered TypeScript app and it turned out to be quite a challenge. I do realize it’s not something everyone has experience with, but perhaps some ideas will come out of this.
The issue is that Jest cannot use Webpack configuration to transpile the code. It has it’s own ts-jest
transform and adding Babel to the mix is supported only for JS files. Currently, I am trying to use “old” transformation Babel plugins as I don’t feel that macros are ready for a production yet and I don’t like current syntax particularly.
I’ve prepared a repo with minimal showcase and attempt at a solution based on composing ts-jest
& babel-jest
together, but for some reason, I am unable to make it work. The TypeScript code gets transpiled, but Lingui plugins won’t do its part.
https://github.com/FredyC/ts-jest-lingui
There is also a log file included with an output from both transformations. I am not sure why is it happening.
Also I would like to point out that I don’t want to use Babel with TypeScript transform as there are some caveats and I am not willing to accept those.
cc @huan086 @quentez @ghostd (in case you have some insight here since you made typescript extractor)
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:7 (5 by maintainers)
Top GitHub Comments
Get rid of ts-jest 😄 I just switched to Babel Typescript and don’t worry about it anymore.
How do you get ride of ts-jest ? That’s the only way for I to get the test running.