This code is the starting point to demonstrate converting your tests from Mocha to Jest using jest-codemods. This code consists of a few utility functions found in ./src/index.js
and a single spec file at ./src/index.spec.js
. The tests use Mocha, Sinon and Chai. After following the steps in the video on egghead.io, you'll have the same tests, only using Jest for the test runner, assertions and mocking and the npm scripts for testing will have been simplified.
- Create a branch just in case things don't go as planned
- Install Jest via npm
- Update the npm scripts in
package.json
to test with Jest - Commit to git -
jest-codemods
will not run and warn you if you have pending changes - Install
jest-codemods
globally (or you could choose to usenpx
) - Run
jest-codemods
CLI and select the appropriate options at the prompts - Observe the output and manually update where needed
- Remove unecessary dependencies
- Enjoy the Jest testing experience