esbuild-jest icon indicating copy to clipboard operation
esbuild-jest copied to clipboard

feat: support esbuild options

Open cdaringe opened this issue 3 years ago • 8 comments

Problem

Current implementation:

  • does not support all esbuild options
  • reimplements some esbuild types

Solution

  • Support esbuild options to be passed thru, so users can use more esbuild APIs to suit their needs
  • Dedupe types
  • Update docs

Discussion

  • the project has prettier in it, my editor picked it up, ...and ran it 😬 . hopefully that's ok? i didn't mean to send a bulk change, but ...editors... and prettier
  • yarn test outside of CI yields:
$ jest --clearCache && jest --detectOpenHandles                                                                                                                                   
Cleared /private/var/folders/b2/_t0w_hyn6jz28xm301k2qp81c9b83j/T/jest_okufzl
jest-haste-map: Haste module naming collision: esbuild-jest
  The following files share their name; please adjust your hasteImpl:
    * <rootDir>/package.json
    * <rootDir>/dist/package.json

this is because the build step symlinks the dist folder. there's certainly ways around that, but FYI, I had to test like CI tests :)

cdaringe avatar Apr 01 '21 03:04 cdaringe

@cdaringe thanks for the PR, it would be good if you could add tests for this PR, to make sure it will not break.

aelbore avatar Apr 01 '21 05:04 aelbore

Would this support the inject option? I need it to inject a JSX tranformer global h into every transformed module as outlined here. Not sure if there are other ways to achieve this.

silverwind avatar Apr 10 '21 14:04 silverwind

Ya, @silverwind , iirc it should. Feel free to pick up the PR. I hit a roadblock with esbuild, thus probably won't be pursuing this further

cdaringe avatar Apr 10 '21 19:04 cdaringe

Not really interested, sorry. I ended up writing my own jest transformer in place of this module (it's actually trivial) but am blocked by jest's ESM bugs currently to proceed.

silverwind avatar Apr 10 '21 20:04 silverwind

For anyone investigating: This approach is unlikely to be able to support build-only options like inject since it still uses only the transformSync API.

bravely avatar Dec 30 '21 18:12 bravely

@aelbore So how is it going, esbuild-jest is dead?

dst0 avatar Nov 13 '22 15:11 dst0