Open petebacondarwin opened 2 years ago
Rather than use @babel/preset-typescript to strip the type annotations, it seems like maybe it would be better to do the esbuild transform first and then pass the results of that into babel-jest to do the jest.mock hoisting? With a little extra work you would also probably be able to hook up the inputSourceMap as well.
Can somebody release it in the way @thebanjomatic mentions it, please ?
Any progress here? If this solution works - despite there being more ideal one - I think anything right now that lets us use type annotations in tests would be a huge improvement :pray:
Any word on this? This is preventing us from using esbuild-jest.
Is repo abandoned by @aelbore ?
This change fixed our problem. 🙏 I've published @petebacondarwin's branch under @epilot/esbuild-jest
in case anyone needs it.
The
@babel/plugin-transform-modules-commonjs
transform runs before the esbuild step, which is where TS type annotations are removed.This can cause files that contain typings to fail with errors like:
This commit ensures that files that are transformed via this Babel plugin have their type annotations removed via the
@babel/preset-typescript
preset beforehand.Fixes #57