Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update migration guide with jest-codemods transformers #4306

Merged
merged 3 commits into from
Aug 20, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions docs/en/MigrationGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,21 @@ next: testing-frameworks
If you'd like to try out Jest with an existing codebase, there are a number of ways to convert to Jest:

* If you are using Jasmine, or a Jasmine like API (for example [Mocha](https://mochajs.org)), Jest should be mostly compatible and easy to migrate to.
* If you are using Mocha, AVA or Tape, you can automatically migrate with Jest Codemods (see below).
* If you are using AVA, Expect.js (by Automattic), Jasmine, Mocha, proxyquire, Should.js or Tape you can automatically migrate with Jest Codemods (see below).
* If you like [chai](http://chaijs.com/), you can upgrade to Jest and continue using chai. However, we recommend trying out Jest's assertions and their failure messages. Jest Codemods can migrate from chai (see below).

### jest-codemods

If you are using [Mocha](https://mochajs.org), [AVA](https://github.com/avajs/ava), [chai](http://chaijs.com/) or [Tape](https://github.com/substack/tape), you can use the third-party [jest-codemods](https://github.com/skovhus/jest-codemods) to do most of the dirty migration work. It runs a code transformation on your codebase using [jscodeshift](https://github.com/facebook/jscodeshift).
If you are using
[AVA](https://github.com/avajs/ava),
[Chai](https://github.com/chaijs/chai),
[Expect.js (by Automattic)](https://github.com/Automattic/expect.js),
[Jasmine](https://github.com/jasmine/jasmine),
[Mocha](https://github.com/mochajs/mocha),
[proxyquire](https://github.com/thlorenz/proxyquire),
[Should.js](https://github.com/tj/should.js/)
or [Tape](https://github.com/substack/tape)
you can use the third-party [jest-codemods](https://github.com/skovhus/jest-codemods) to do most of the dirty migration work. It runs a code transformation on your codebase using [jscodeshift](https://github.com/facebook/jscodeshift).

Install Jest Codemods with `npm` by running:

Expand All @@ -30,4 +39,4 @@ To transform your existing tests, navigate to the project containing the tests a
jest-codemods
```

More information can be found at https://github.com/skovhus/jest-codemods.
More information can be found at https://github.com/skovhus/jest-codemods.