jest-schematic
jest-schematic copied to clipboard
test replacing ts-jest with @swc-node/jest
We don't use this package, but we use jest & angular and maybe you are interested.
We replaced ts-jest with @swc-node/jest. Cold cache jest
went from 60s to 7s.
swc is a typescript to javascript compiler that also supports annotations & metadata export, thus works with angular jit. swc is written in rust and is ~70x faster as typescript. So by using it you eliminate the compile overhead and are mostly left running the tests themself.
using swc-jest as a jest transformer is pretty straight forward, this is our transform block in jest.config.js
transform: {
'\\.ts$': [
require.resolve('@swc-node/jest'),
{
target: 'es2018',
module: 'commonjs',
experimentalDecorators: true,
emitDecoratorMetadata: true,
dynamicImport: true,
sourcemap: true,
},
],
}