aelbore / esbuild-jest

A Jest transformer using esbuild
516 stars 50 forks source link

Needless Babel transform (breaks where Babel not used) #80

Open waynerobinson opened 1 year ago

waynerobinson commented 1 year ago

The following line https://github.com/aelbore/esbuild-jest/blob/daa5847b3b382d9ddf6cc26e60ad949d202c4461/src/index.ts#L33 is pretty greedy with determining if Babel should be used for a transform or not.

I have lock() functions in my code that match on this and then cause a transform error.

Should this be changed to sources.code.indexOf("mock(")?

lukasMega commented 1 year ago

I think it seems like typo and there should be mock( instead of ock(

itoudium commented 1 year ago

I'm having a problem with a code that contains the word "Block" in this issue.

It's easy to fix this problem, but I'm not using jest.mock, so I can't verify