Skip to content
J

jest-codemods

Codemods for migrating to Jest

by skovhusOpen source

#1114in UI Libraries
0In stores

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 f…

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

T

ts-jest

A Jest transformer with source map support

UI Libraries
Launch
J

javascript-typescript-jest

Jest testing best practices for JavaScript and TypeScript projects

AI Skills
Get
J

Jest

Delightful JavaScript Testing

Developer Tools
Launch
J

jest-preview

Debug your Jest tests. Effortlessly

UI Libraries
Launch
R

react19-test-patterns

Provides before/after patterns for migrating test files

AI Skills
Get
M

migrate-to-shoehorn

Migrate test files from `as` type assertions to @total-typescript/shoehorn

AI Skills
Get

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

Developer Stuff

Badges