Saturday, 5 September 2020

Make your unit tests faster again with zero overhead!

swc-node is a TypeScript/JavaScript compiler which is a NodeJS native addon for swc.Swc compiler is 7~40x faster than babel, swc-node implement @swc-node/jest and @swc-node/register top on it.swc-node is also built on top of napi-rs , which has some killer features rather than the other packages which built from native code:Minimal third part dependencies, no need for node-gyp rust/C++ toolchains. You can just install it in your Docker environment and use it.No additional binary files need to download in postinstall scripts. Everything is available on npm.Compatible to all NodeJS versions after v8.9.0, No need to reinstall after NodeJS upgraded.And thanks to deno ecosystem(swc is heavily used by deno ecosystem), swc is stable and support latest TypeScript/JavaScript feature now:TypeScript experimentalDecoratorsTypeScript emitDecoratorMetadatajsx pargmaES5 ~ ES2020 language featuresMore over the swc featues, I implement jest-hoist-transformer in @swc-node/jest, which would help you migrate from ts-jest smoothly.Many projects in Bytedance has running with @swc-node/jest (jest tests) and @swc-node/register (ava tests).​https://preview.redd.it/7zoofasuqgl51.png?width=1050&format=png&auto=webp&s=2b6742413fc4321e236e3b74ecbcc7fe9d3ca63cSo try it and enjoy the zero overhead performance improvement!

Submitted September 06, 2020 at 06:26AM by LongYinan

No comments:

Post a Comment