Description
jest-codemods is a set of codemods that rewrite existing JavaScript and TypeScript test files so they run on Jest. It covers tests written for AVA, Chai, Expect.js, [email protected], Jasmine, Mocha, proxyquire, Should.js, Tape, Sinon and Node-Tap. A codemod is a small program that applies structured changes across a codebase, more precise than search and replace. The project exists so teams can try Jest on a real codebase without converting every test by hand. You run it through an interactive CLI with npx, or install it globally with npm, and point it at a directory of tests. The transformations can also be run directly with jscodeshift. The authors note that some manual fixes are still expected after a run, and the console output flags the places that need attention.…
Highlights
- Converts tests from AVA, Chai, Mocha, Jasmine, Tape, Sinon and more to Jest
- Interactive CLI via npx jest-codemods
- Transforms a whole directory of test files at once
- Transformations can be run directly with jscodeshift
- Option for explicit require() calls when not running Jest on Node.js
Ratings & Reviews
No ratings yet
Be the first to rate jest-codemods.
People also visit
jest-codemods FAQ
What does jest-codemods do?
It automatically rewrites test files written for other frameworks, such as Mocha, Jasmine, AVA, Chai, Tape or Sinon, into Jest syntax so you can move an existing test suite to Jest.
How do I run it?
Run npx jest-codemods to start the interactive CLI, or install it globally with npm install -g jest-codemods. To transform every test file in a folder, run jest-codemods . in that folder.
Will the migration be fully automatic?
Not always. The project aims to make migration as smooth as possible, but some manual intervention and tweaks are expected. Check the console output for errors and places that need a manual fix.
Can I use it without the CLI?
Yes. The CLI wraps jscodeshift, and you can run the transformations directly with jscodeshift if you prefer.
What if I run Jest in a browser or use another runner?
Choose the option that adds explicit require() calls when prompted. You may then need to install packages such as expect as dev dependencies.
What are the best jest-codemods alternatives?
Popular alternatives to jest-codemods include ts-jest, jest-preview and Early AI. See all jest-codemods alternatives



















