![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
jest-codemods
Advanced tools
Codemods that simplify migrating JavaScript test files from Mocha, Tape and AVA to Jest.
Codemods are small programs that help you automate changes to your codebase. Think of them as search and replace on steroids. They are executed by the Facebook jscodeshift tool.
This tool is made for trying out Jest on your existing test files. We strive to make the migration as smooth as possible, but some manual intervention and tweaks to your tests are to be expected.
$ npm install -g jest-codemods
This installs the runner as jest-codemods
.
To use the interactive CLI run
$ jest-codemods
If you are using Flow types
$ jest-codemods --parser flow
For more options
$ jest-codemods --help
Codemods for migrating test files to Jest.
Usage
$ jest-codemods <path> [options]
path Files or directory to transform. Can be a glob like src/**.test.js
Options
--force, -f Bypass Git safety checks and forcibly run codemods
--dry, -d Dry run (no changes are made to files)
--parser The parser to use for parsing your source files (babel | babylon | flow) [babel]
To transform all test files in a directory run jest-codemods test-folder
in your terminal.
Notice the console output for errors, manual intervention and tweaks are to be expected.
To make the process as simple as possible, we recommend the jest-codemods
CLI
that wraps the jscodeshift
executable.
But you can also run the transformations directly using jscodeshift
.
$ npm install -g jscodeshift
$ npm install jest-codemods
$ jscodeshift -t node_modules/jest-codemods/dist/transformers/tape.js test-folder
$ jscodeshift -t node_modules/jest-codemods/dist/transformers/ava.js test-folder
$ jscodeshift -t node_modules/jest-codemods/dist/transformers/mocha.js test-folder
$ jscodeshift -t node_modules/jest-codemods/dist/transformers/chai-assert.js test-folder
If possible import
/ require
statements determine if any transformation are carried out.
The original code quoting style is preserved.
Warnings are made if packages are used that are incompatible with Jest.
Usage of proxyquire
is replaced with Jest mocks.
Warnings for unsupported AVA features:
t.skip
Warnings for unsupported Tape features:
t.timeoutAfter
t.deepLooseEqual
t.looseEqual
t.looseEquals
t.notDeepLooseEqual
t.notLooseEqual
t.notLooseEquals
t.skip
test.createStream
test.onFinish
Thanks to avajs/ava-codemods for inspiration and CLI setup.
The Mocha and Chai support began its life at paularmstrong/mocha-to-jest-codemod
To get started, run:
npm install
When developing:
npm run check # (runs lint and unit test)
npm run lint
npm run test
npm run test:cov
npm run test:watch
MIT
FAQs
Codemods for migrating test files to Jest
The npm package jest-codemods receives a total of 4,179 weekly downloads. As such, jest-codemods popularity was classified as popular.
We found that jest-codemods demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.