Skip to content

Commit

Permalink
Update migration guide with jest-codemods transformers (jestjs#4306)
Browse files Browse the repository at this point in the history
* Update migration guide with jest-codemods transformers

* Try to fix Cannot find module 'jest-runner'

* Update package.json
  • Loading branch information
skovhus authored and cpojer committed Aug 20, 2017
1 parent aa2829b commit c4575b3
Showing 1 changed file with 12 additions and 3 deletions.
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.

0 comments on commit c4575b3

Please sign in to comment.