Skip to content

Migrate from Mocha/Chai to Jest #166

@mcmire

Description

@mcmire

We've standardized on using Jest instead of Mocha for all of our libraries.

  • Remove mocha, chai, and chai-spies as dependencies and replace it with jest
  • Copy jest.config.js from the module template
  • Remove the resolutions field from package.json as we don't need it
  • Convert existing tests from Mocha/Chai syntax to Jest
  • Replace the test script in package.json with the equivalent jest line (see the module template), and add a test:watch script
  • If Bring linting pipeline in sync with module template #164 has already been completed, then add our eslint-config-jest package to package.json and add a Jest section to .eslintrc.js (see the module template)
  • Run yarn test. If Jest does not report that 100% test coverage has not been achieved, then add jest-it-up as a development dependency; otherwise adjust the coverage thresholds in jest.config.js to match the numbers reported.

Tasks:

  • Migrate to 'jest'
  • Add jest-it-up

Definition of Done

  • Whenever applies, any change unit tested, reviewed(approved) and documented(JSDOC at least)
  • We have changelog entries for any related changes
  • Any changed APIs have comprehensive inline documentation
  • Any changed public APIs are well covered by unit tests
  • Other items
  • If a planning/research ticket, then the plan has been reviewed and approved by at least 1 team members

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions