Skip to content

Wdfn 826 - replace jest with vitest

Before making a pull request

  • Put the appropriate EXEMPT flag if needed in the MR label (see https://practices.wma.chs.usgs.gov/practice/peer_code_review/)
  • Run all linters (make lint)
  • Run all tests (make test)
  • Update the changelog appropriately
  • If making a release, update code.json metadataLastUpdated and bump CHANGELOG.md to next version.

Description

  • Set the "global" test option to true to make globals visible by default. In vitest, globals such as "describe", "it", and "except" are not visible by default and have to be imported. Setting this to true makes them visible.
  • Replace "jest.xxx" with and "vi.xxx".
  • Replaced the package "jest-fetch-mock" with "vitest-fetch-mock". There are some minor differences in the API as can be seen in the code.
  • Removed the package "jest-mock-console" by using vitest vi.stubGlobal to stub the console functions (usually log and error) with mock functions.
  • Mocking module imports is handled differently. There are a few ways to do this depending on when you just want to mock a module or whether you want to spy on a module function.
  • Tests that import Vue single file components must now use the .vue extension.

After making a pull request

  • If appropriate, put the link to the PR in the JIRA ticket
  • Assign someone to review unless the change is trivial
  • Check the accessibility CI step and fix or explain any issues.

Merge request reports

Loading