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

Options are not working correctly

Open mariobm opened this issue 4 years ago • 0 comments

https://github.com/aelbore/esbuild-jest/blob/1bf605ad7a338c47da16efd1df9439950de05fb6/src/index.ts#L16-L20 What is the point of this code? If you have multiple transforms, it only considers the last one. I had problems with other plugin for this reason. I have 3 transforms:

transform:
      {
        '^.+\\.(js|jsx|mjs|cjs|ts|tsx)$': 'node_modules\\react-scripts\\config\\jest\\babelTransform.js',
        '^.+\\.css$': 'node_modules\\react-scripts\\config\\jest\\cssTransform.js',
        '^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|css|json)$)': 'node_modules\\react-scripts\\config\\jest\\fileTransform.js'
      }

I changed the first one to esbuild-jest. On ".jsx" extension runs perfectly but when i switch to ".js" it throws error. That's why I added loaders option to it. But i couldn't see the difference because only first one had loaders others didn't and i ended up with empty object returned from getOptions.

mariobm avatar Jan 12 '21 19:01 mariobm