proposal: @oxc/jest
package
#4247
Replies: 4 comments
-
My only concern is the maintenance cost, the core team will not have the time to maintain this :-( I'm fine with shipping all the puzzles pieces have a separate repo that glues things together with its own release pipeline. |
Beta Was this translation helpful? Give feedback.
-
Once transformation is exposed as an npm package, creating a jest plugin package is relatively trivial. |
Beta Was this translation helpful? Give feedback.
-
Yes please, ping me if you don't have all the permissions. |
Beta Was this translation helpful? Give feedback.
-
The Jest testing framework supports transforming code via transform plugins, such as
babel-jest
,ts-jest
, and@swc/jest
. It would be a large quality-of-life improvement to use oxc to transform files instead of any of the above packages. The transformer is progressing quite well, and making it usable in Jest could help with the adoption of oxc in general.Unfortunately, Jest only ships with
experimental support for ESM
, so transpilation to CJS is a must-have for this to work properly. I took a crack at this about two weeks ago. Within about 2 hours I got about 80% of the way there, with this missing plugin being the only remaining major blocker.Goals
package.json
,tsconfig.json
,.babelrc
, etc to configure transpilation correctlyTasks
oxc_transform
as an NPM package, similar to@oxc/parser
@babel/plugin-transform-modules-commonjs
plugin@oxc/jest
NPM package@oxc/jest
to the website.Considerations
@swc/jest
in a separate git repo from their core package. Should we do the same thing?@swc/jest
that prevent widespread adoption:@swc/jest
unconditionally hoists package imports, which breaks module mocking. This behavior is undocumented, and attempts to fix it by setting the appropriate config property fail as the package always overrides this user-provided value..swcrc
does not appear to be respected; I've only ever gotten configuration to work by passing a config option explicitly.@swc/jest
does not export type definitions for its config, and the various settings are completely undocumentedBeta Was this translation helpful? Give feedback.
All reactions