New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jest-codemods

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-codemods

Codemods for switching test framework to Jest

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

jest-codemods

Codemods that simplify migrating JavaScript test files to Jest. Currently we support migrating from Tape to Jest. But we plan to support AVA and other test runners in the future.

Build Status version Tweet

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 are to be expected.

Install

$ npm install -g jest-codemods

This installs the runner as jest-codemods.

Usage (CLI)

Currently we support migrating from Tape to Jest.

$ jest-codemods --help

	Codemod that simplify migrating to Jest.

	Usage
	  $ jest-codemods <path> [options]

	path		Files or directory to transform. Can be a glob like src/**.test.js

	Only files with Tape will be converted.

	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 mySrcFolder in your terminal.

Only files requiring or importing Tape will be transformed. Notice the console output for errors, manual intervention and tweaks are to be expected.

Usage (jscodeshift)

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 mySrcFolder

Inspiration

Thanks to ava-codemods for inspiration.

Contributing

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

License

MIT

Keywords

FAQs

Package last updated on 21 Sep 2016

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc