DEV Community

Changwoo Yoo
Changwoo Yoo

Posted on

Running react native testing 3x faster

I just made react-native testing 3x faster than when I was using babel-jest!

babel-jest (61s) react-native-fast-jest (23s)

How to use?

1. Install react-native-fast-jest

npm i --save-dev react-native-fast-jest 
Enter fullscreen mode Exit fullscreen mode

2. Configure .swcrc on the root like below.

{ "jsc": { "parser": { "syntax": "typescript", "jsx": true, "tsx": true, "dynamicImport": false, "privateMethod": false, "functionBind": false, "exportDefaultFrom": false, "exportNamespaceFrom": false, "decorators": false, "decoratorsBeforeExport": false, "topLevelAwait": false, "importMeta": false, "preserveAllComments": false }, "transform": null, "target": "es5", "loose": true, "externalHelpers": false, "keepClassNames": false }, "isModule": true } 
Enter fullscreen mode Exit fullscreen mode

3. Configure jest transform config.

transform: { '^.+\\.(t|j)sx?$': 'react-native-fast-jest', }, 
Enter fullscreen mode Exit fullscreen mode

That's it!! You just made the react-native testing 3x faster!

If you're interested in the source code of the library, you can visit here: https://github.com/changwoolab/react-native-fast-jest

Top comments (0)