- 1 minute read

If you want to migrate Jasmine tests to Jest, jest-codemods helps you a lot. I used it in a project with more than 200 tests, and it slashed the effort by several days:

npx jest-codemods

The tool is going to ask you a few questions. Here are the correct answers for a standard Angular project:

? Which parser do you want to use? ! TypeScript ? Which test library would you like to migrate from? ! Jasmine: globals ? Are you using the global object for assertions (i.e., without requiring them)? ! Yes, and I'm not afraid of false positive transformations ? Will you be using Jest on Node.js as your test runner? ! Yes, use the globals provided by Jest (recommended)

The tool doesn't fix every incompatiblity. Luckily, most issues are pretty obvious. Richard Wotzlaw has written a deep dive on migrating to Jest, including list of replacements.


Comments