Typescript-TDD / ts-auto-mock

Typescript transformer to unlock automatic mock creation for interfaces and classes
https://typescript-tdd.github.io/ts-auto-mock
MIT License
598 stars 16 forks source link

Add support for babel (Maybe) #129

Closed uittorio closed 4 years ago

uittorio commented 4 years ago

When babel is used in combination with Typescript is not possible to use ts-auto-mock because the code is compiled by Babel.

This issue opened in typescirpt-is explain the scenario (https://github.com/woutervh-/typescript-is/issues/18)

A possible solution would be to write another plugin for babel

I've opened this issue as a placeholder, I'm not sure yet how much work is involved to achieve this.

Pmyl commented 4 years ago

Two questions:

uittorio commented 4 years ago

You can use babel-jest instead of ts-jest to run your test. Babel is used in combination of typescript to benefit from the type safety.

uittorio commented 4 years ago

We don't have any plan to create a transformer for babel.

imjordanxd commented 3 years ago

@uittorio Any chance of reviving this? I've found TS-Jest to become unbearably slow. Setting isolatedModules: true unfortunately doesn't help.

uittorio commented 3 years ago

Hi @imjordanxd! Sorry for the late reply! I think we can improve the configuration to make it faster! Can you share your project so I can see what we can do?

As we mentioned before babel ts auto mock would be a completely different project!

imjordanxd commented 3 years ago

Hey @uittorio, I'm working on a private project so unfortunately, I can't share it. Are there any details you require? At a very high level, I'm using the basic installation here to test my React application with testing-library.

imjordanxd commented 2 years ago

Hi @uittorio, just following up on this to see if you have any suggestions?

jonas2727 commented 1 year ago

@Pmyl I can tell you a benefit. Relay requires the babel-plugin-relay to work (replaces GraphQL-tags with compiled artifacts). And for unittesting fragments, the plugin is required to also transpile the test code. Thus Relay and ts-auto-mock cannot be used together which is really sad