back to home

skovhus / jest-codemods

Codemods for migrating to Jest https://github.com/facebook/jest 👾

887 stars
81 forks
35 issues
TypeScriptJavaScriptShell

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing skovhus/jest-codemods in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/skovhus/jest-codemods)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

jest-codemods 👾 Codemods that simplify migrating JavaScript and TypeScript test files from AVA, Chai, Expect.js (by Automattic), Expect@1.x (by mjackson), Jasmine, Mocha, proxyquire, Should.js, Tape, Sinon, and Node-Tap to Jest. [![version][version-badge]][package] Codemods are small programs that help you automate changes to your codebase. Think of them as search and replace on steroids. We made jest-codemods so you can try out Jest on your existing codebase. We strive to make the migration as smooth as possible, but some manual intervention and tweaks to your tests are to be expected. Usage (CLI) To use the interactive CLI run $ npx jest-codemods If you do not have installed, you can install the command globally by running . For more options To transform all test files in a directory run in your terminal. Notice the console output for errors, manual intervention and tweaks might be required. Usage (jscodeshift) To make the process as simple as possible, we recommend the CLI that wraps the jscodeshift executable. But you can also run the transformations directly using . Test environment: Jest on Node.js or other If you're using Jest as your test runner and executing tests on Node.js, you'll want to use the default option when prompted. In this case, assumes that global values such as and are provided and will not them explicitly. If, however, you are using a different test runner or executing Jest tests in a browser, you may need to choose the option with explicit calls. In the second case, after running , you might need to install a few dependencies: yarn add --dev expect jest-mock npm install --save-dev expect jest-mock pnpm install --save-dev expect jest-mock Transformations If possible / 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. Inspiration Thanks to avajs/ava-codemods for inspiration and original CLI setup. The Mocha and Chai assert support began its life at paularmstrong/mocha-to-jest-codemod. Chai Should/Expect came from AlexJuarez/chai-to-jasmine. Links • Official Jest migration guide https://jestjs.io/docs/en/migration-guide • "Migrating 2,000+ Specs from Karma to Jest" https://labs.contactually.com/migrating-2-000-specs-from-karma-to-jest-25dd8b0f3cfb • "Into the Great Unknown — Migrating from Mocha to Jest" https://ebaytech.berlin/into-the-great-unknown-migrating-from-mocha-to-jest-3baced083c7e • "Automate your migration to Jest using codemods" Egghead video https://egghead.io/lessons/jest-automate-your-migration-to-jest-using-codemods • "Migrating Ava to Jest" https://codedaily.io/tutorials/11/Migrating-Ava-to-Jest • "Switching from Ava to Jest for TypeScript" https://shift.infinite.red/switching-from-ava-to-jest-for-typescript-a6dac7d1712f • "Migrating a Mocha project to Jest Test Framework" https://medium.com/@liran.tal/migrating-a-mocha-project-to-jest-test-framework-76d13d76685 • "Migrating to Jest on the P2P team at PayPal" https://blog.kentcdodds.com/migrating-to-jest-881f75366e7e Contributing To get started, run: pnpm install When developing: pnpm verify # (build/lint/test) pnpm build pnpm lint pnpm test pnpm test:cov pnpm test:watch License MIT [version-badge]: https://img.shields.io/npm/v/jest-codemods.svg?style=flat-square [package]: https://www.npmjs.com/package/jest-codemods